Expand description
Low-level FFI bindings for fig’s C ABI, plus the build script that compiles
and links the native libfig.a.
This is the -sys layer: raw extern "C" functions, #[repr(C)] type
mirrors, and status/format constants — nothing else. The safe, ergonomic
API (and serde/derive integration) lives in the fig crate, which depends
on this one. Direct use is unsafe and unstable across ABI-version bumps.
Structs§
- FigClosed
Containers - Mirror of
FigClosedContainers. - FigComment
Delimiter - Mirror of
FigCommentDelimiter. - FigComment
Row - Mirror of
FigCommentRow. - FigComments
- Mirror of
FigComments. - FigDialect
Desc - Mirror of
FigDialectDesc. - FigDirective
Row - Mirror of
FigDirectiveRow. - FigError
- A caller-allocated parse diagnostic. Mirrors
FigErrorinfig.h. Lead withsize = size_of::<FigError>(): the library writes only the fieldssizecovers, so it can gain fields in a later release without breaking this layout.byte_offset/line/columnare 0 when unknown. A runtime language’s parse failure fillsbyte_offsetwith the offset its parser reported; the compiled formats leave all three 0 for now.messageis NUL-terminated and truncated to fit;message_lenexcludes the NUL. - FigKey
Value - A
key: valueentry forfig_value_map. MirrorsFigKeyValueinfig.h. - FigLanguageV
Table - Mirror of
FigLanguageVTable. The fiverender_*slots andprintareOption, which is the null pointer on the C side. - FigMention
Row - Mirror of
FigMentionRow. - FigNode
Row - Mirror of
FigNodeRow. - FigNode
Table - Mirror of
FigNodeTable. - FigPath
Segment - One step of a path:
kind == 0selects mapping keykey_ptr[0..key_len];kind == 1selects sequence elementindex. MirrorsFigPathSegmentinfig.h. - FigPrint
Options - Mirror of
FigPrintOptions. - FigRegion
- FigRegion
Row - Mirror of
FigRegionRow. - FigRender
Request - Mirror of
FigRenderRequest: everything a renderer is told. fig writes it, and a renderer reads a field only whensizecovers it. - FigSection
Header - Mirror of
FigSectionHeader. - FigSerialize
Options - Output style for
fig_value_serialize_opts/fig_document_serialize. MirrorsFigSerializeOptionsinfig.h. ALL trailing fields are declared explicitly (not left to struct padding): withsize = size_ofthe core reads every byte up tosize, so an undeclaredstrip_comments/losslesswould otherwise be read out of uninitialized padding. - FigSpan
- FigStatus
- A fig C ABI status code, as a transparent wrapper over the raw
c_intthe ABI returns — deliberately not a Rustenum. - FigStr
- A borrowed UTF-8 string slice (
ptr[0..len]) passed across the C ABI. MirrorsFigStrinfig.h; used for the key list of*_reorder_keys. - FigSyntax
- Mirror of
FigSyntax. - FigWarning
- One lossy event from
fig_*_diagnose, pulled by index viafig_*_warning. Caller-allocated; lead withsize = size_of::<FigWarning>()(same policy asFigSerializeOptions/FigError).path/noteare NOT NUL-terminated and borrow the producing handle’s diagnostics arena (valid until the next diagnose on it or its destroy) — copy them out before then. MirrorsFigWarninginfig.h.
Enums§
- FigDocument
- FigEditor
- FigEmbed
- FigEmbed
Container - The container half of an embed selector; every
fig_embed_*entry point that selects a region takes one of these beside aFigFormat. The four parametric containers read the format; the three presets pin their own and ignore it. MirrorsFigEmbedContainerinfig.h(ABI 2). - FigFormat
- FigNode
Kind - FigValue
Constants§
- FIG_
COMMENT_ BLOCK - FIG_
COMMENT_ DANGLING - FIG_
COMMENT_ LEADING - FIG_
COMMENT_ LINE - FIG_
COMMENT_ TRAILING - FIG_
DEPTH_ NONE - Mirror of
FIG_DEPTH_NONE: a vtable’smax_mapping_depthwhen unbounded. - FIG_
EXT_ NONE - Mirror of
FIG_EXT_NONE. - FIG_
FORMAT_ RUNTIME_ BASE - Mirror of fig.h’s
FIG_FORMAT_RUNTIME_BASE: a format integer at or above this names a language registered at runtime, assigned per process and never aFigFormatvariant. Every compiled-in variant above is below it. - FIG_
LANGUAGE_ VTABLE_ VERSION - Mirror of
FIG_LANGUAGE_VTABLE_VERSION. - FIG_
LEN_ NONE - FIG_
LOSSLESS_ ENVELOPE FigLanguageVTable::lossless: the language takes the$figenvelope.- FIG_
MENTION_ ENTRY - FIG_
MENTION_ HEADER - FIG_
NATIVE_ NULL - With the envelope, a null the format holds natively.
- FIG_
NODE_ NONE - Sentinel for “no such node”, matching
FIG_NODE_NONEinfig.h. - FIG_
OFFSET_ NONE - Mirror of
FIG_OFFSET_NONE/FIG_LEN_NONE: an absent optional span or string. - FIG_
ROW_ NONE - Mirror of
FIG_ROW_NONE: the root’sparent.
Functions§
- fig_
document_ ⚠destroy - fig_
document_ ⚠diagnose - fig_
document_ ⚠root - fig_
document_ ⚠serialize - fig_
document_ ⚠warning - fig_
editor_ ⚠add_ dangling_ comment - fig_
editor_ ⚠add_ leading_ comment - fig_
editor_ ⚠append_ container_ to_ seq - fig_
editor_ ⚠append_ seq - fig_
editor_ ⚠comment_ out - fig_
editor_ ⚠create - fig_
editor_ ⚠delete_ container - fig_
editor_ ⚠delete_ dangling_ comments - fig_
editor_ ⚠delete_ key - fig_
editor_ ⚠delete_ leading_ comments - fig_
editor_ ⚠delete_ trailing_ comment - fig_
editor_ ⚠destroy - fig_
editor_ ⚠get_ dangling_ comment - fig_
editor_ ⚠get_ leading_ comment - fig_
editor_ ⚠get_ trailing_ comment - fig_
editor_ ⚠insert_ container - fig_
editor_ ⚠insert_ key - fig_
editor_ ⚠insert_ named_ key - fig_
editor_ ⚠move_ container - A NULL
dest_pathmeans “to the end of the document” — distinct from a zero-length path, which every other entry point reads as the root. - fig_
editor_ ⚠move_ item - fig_
editor_ ⚠move_ key - fig_
editor_ ⚠prepend_ seq - fig_
editor_ ⚠remove_ seq_ item - fig_
editor_ ⚠rename_ container - fig_
editor_ ⚠reorder_ containers - fig_
editor_ ⚠reorder_ items - fig_
editor_ ⚠reorder_ keys - fig_
editor_ ⚠replace_ key - fig_
editor_ ⚠replace_ named_ key - fig_
editor_ ⚠replace_ val - fig_
editor_ ⚠set - fig_
editor_ ⚠set_ sequence - fig_
editor_ ⚠set_ trailing_ comment - fig_
editor_ ⚠source - fig_
editor_ ⚠uncomment_ dangling - fig_
editor_ ⚠uncomment_ leading - fig_
embed_ ⚠add_ dangling_ comment - fig_
embed_ ⚠add_ leading_ comment - fig_
embed_ ⚠append_ seq - fig_
embed_ ⚠comment_ out - fig_
embed_ ⚠delete_ dangling_ comments - fig_
embed_ ⚠delete_ key - fig_
embed_ ⚠delete_ leading_ comments - fig_
embed_ ⚠delete_ trailing_ comment - fig_
embed_ ⚠destroy - fig_
embed_ ⚠detect - fig_
embed_ ⚠extract - fig_
embed_ ⚠get_ dangling_ comment - fig_
embed_ ⚠get_ leading_ comment - fig_
embed_ ⚠get_ trailing_ comment - fig_
embed_ ⚠insert_ key - fig_
embed_ ⚠insert_ named_ key - fig_
embed_ ⚠move_ item - fig_
embed_ ⚠move_ key - fig_
embed_ ⚠open - fig_
embed_ ⚠open_ or_ init - fig_
embed_ ⚠prepend_ seq - fig_
embed_ ⚠remove_ seq_ item - fig_
embed_ ⚠render - fig_
embed_ ⚠reorder_ items - fig_
embed_ ⚠reorder_ keys - fig_
embed_ ⚠replace_ body - fig_
embed_ ⚠replace_ key - fig_
embed_ ⚠replace_ named_ key - fig_
embed_ ⚠replace_ val - fig_
embed_ ⚠retype - Re-house an embedded region under a different archetype’s fences. On
OKthe result is an OWNED buffer — release it withfig_free, passing back the exactout_len. Added in core 2.7.0. - fig_
embed_ ⚠set - fig_
embed_ ⚠set_ sequence - fig_
embed_ ⚠set_ trailing_ comment - fig_
embed_ ⚠uncomment_ dangling - fig_
embed_ ⚠uncomment_ leading - fig_
format_ ⚠by_ name - fig_
format_ ⚠capabilities - fig_
free ⚠ - Sized free for a buffer fig allocated (
fig_embed_retype’s result) or that the caller obtained fromfig_alloc.lenmust be exact. - fig_
keyvalue_ ⚠key - fig_
keyvalue_ ⚠value - fig_
language_ ⚠register - fig_
language_ ⚠vtable_ version - fig_
native_ ext - With the envelope, the
FigExtKindkheld natively. - fig_
node_ ⚠bool - fig_
node_ ⚠child_ count - fig_
node_ ⚠extended - fig_
node_ ⚠first_ child - fig_
node_ ⚠kind - fig_
node_ ⚠next_ sibling - fig_
node_ ⚠number - fig_
node_ ⚠string - fig_
parse ⚠ - fig_
parse_ ⚠ex - fig_
value_ ⚠bool - fig_
value_ ⚠create - fig_
value_ ⚠destroy - fig_
value_ ⚠diagnose - fig_
value_ ⚠extended - fig_
value_ ⚠int - fig_
value_ ⚠map - fig_
value_ ⚠null - fig_
value_ ⚠number - fig_
value_ ⚠seq - fig_
value_ ⚠serialize - fig_
value_ ⚠serialize_ opts - fig_
value_ ⚠string - fig_
value_ ⚠uint - fig_
value_ ⚠warning - fig_
version ⚠ - fig_
version_ ⚠string
Type Aliases§
- FigFree
Bytes Fn - FigFree
Table Fn - FigNode
Id - FigParse
Fn - FigPrint
Fn - FigRender
Fn - Every
render_*slot’s shape.