Describe the memory layout of a named boundary type (pure). A field list goes in, a layout descriptor comes out, or a diagnostic is thrown.
The descriptor carries the fields in declaration order with their normalized types and C-ABI byte offsets, plus the whole struct's size and alignment:
(describe 'Point '[x :f64 y :f64])
=> {:name Point
:fields [{:name x :type {:kind :scalar :name :f64} :offset 0}
{:name y :type {:kind :scalar :name :f64} :offset 8}]
:size 16 :align 8}
The same descriptor renders the extern struct the generated Zig uses
and drives the field marshalling FFM performs. Fields are scalars with
an FFM carrier; the layout matches Zig's extern struct (C ABI).
Describe the memory layout of a named boundary type (pure). A field
list goes in, a layout descriptor comes out, or a diagnostic is thrown.
The descriptor carries the fields in declaration order with their
normalized types and C-ABI byte offsets, plus the whole struct's size
and alignment:
(describe 'Point '[x :f64 y :f64])
=> {:name Point
:fields [{:name x :type {:kind :scalar :name :f64} :offset 0}
{:name y :type {:kind :scalar :name :f64} :offset 8}]
:size 16 :align 8}
The same descriptor renders the `extern struct` the generated Zig uses
and drives the field marshalling FFM performs. Fields are scalars with
an FFM carrier; the layout matches Zig's `extern struct` (C ABI).(describe type-name fields)Build the layout descriptor for a named type from its fields, a
vector of name type pairs. Throws a diagnostic for an odd field list
or a field that has no FFM carrier.
Build the layout descriptor for a named type from its `fields`, a vector of `name type` pairs. Throws a diagnostic for an odd field list or a field that has no FFM carrier.
(describe-enum type-name members)The descriptor for a defenumz type: an i32-backed enum whose
members cross as keywords. Throws for an odd member list or a member
with a non-integer value.
The descriptor for a `defenumz` type: an `i32`-backed enum whose members cross as keywords. Throws for an odd member list or a member with a non-integer value.
(describe-record type-name fields record-ns)The layout descriptor for a defrecordz type: the struct layout of
describe, plus the qualified map-factory symbol the boundary resolves
to rebuild the record from its fields on a return.
The layout descriptor for a `defrecordz` type: the struct layout of `describe`, plus the qualified map-factory symbol the boundary resolves to rebuild the record from its fields on a return.
(enum? descriptor)True when a layout descriptor describes a defenumz enum rather than a
struct or record.
True when a layout descriptor describes a `defenumz` enum rather than a struct or record.
(zig-decl descriptor)The Zig declaration for a named type: an enum for a defenumz and an
extern struct for a deftypez or defrecordz.
The Zig declaration for a named type: an `enum` for a `defenumz` and an `extern struct` for a `deftypez` or `defrecordz`.
(zig-enum {type-name :name :keys [values]})The enum(i32) declaration the generated Zig uses for an enum layout.
The `enum(i32)` declaration the generated Zig uses for an enum layout.
(zig-struct {type-name :name :keys [fields]})The extern struct declaration the generated Zig uses for a layout.
The `extern struct` declaration the generated Zig uses for a layout.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |