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§
- 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 (always 0 in this release — offset plumbing is a planned core follow-up).messageis NUL-terminated and truncated to fit;message_lenexcludes the NUL. - FigKey
Value - A
key: valueentry forfig_value_map. MirrorsFigKeyValueinfig.h. - FigPath
Segment - One step of a path:
kind == 0selects mapping keykey_ptr[0..key_len];kind == 1selects sequence elementindex. MirrorsFigPathSegmentinfig.h. - FigRegion
- 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. - 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§
Constants§
- FIG_
NODE_ NONE - Sentinel for “no such node”, matching
FIG_NODE_NONEinfig.h.
Functions§
- fig_
document_ ⚠destroy - fig_
document_ ⚠diagnose - fig_
document_ ⚠root - fig_
document_ ⚠serialize - fig_
document_ ⚠warning - fig_
editor_ ⚠add_ leading_ comment - fig_
editor_ ⚠append_ seq - fig_
editor_ ⚠create - fig_
editor_ ⚠delete_ key - fig_
editor_ ⚠delete_ leading_ comments - fig_
editor_ ⚠delete_ trailing_ comment - fig_
editor_ ⚠destroy - fig_
editor_ ⚠get_ leading_ comment - fig_
editor_ ⚠get_ trailing_ comment - fig_
editor_ ⚠insert_ key - fig_
editor_ ⚠move_ item - fig_
editor_ ⚠move_ key - fig_
editor_ ⚠prepend_ seq - fig_
editor_ ⚠remove_ seq_ item - fig_
editor_ ⚠reorder_ items - fig_
editor_ ⚠reorder_ keys - fig_
editor_ ⚠replace_ key - fig_
editor_ ⚠replace_ val - fig_
editor_ ⚠set - fig_
editor_ ⚠set_ sequence - fig_
editor_ ⚠set_ trailing_ comment - fig_
editor_ ⚠source - fig_
embed_ ⚠add_ leading_ comment - fig_
embed_ ⚠append_ seq - 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_ leading_ comment - fig_
embed_ ⚠get_ trailing_ comment - fig_
embed_ ⚠insert_ 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_ val - fig_
embed_ ⚠set - fig_
embed_ ⚠set_ sequence - fig_
embed_ ⚠set_ trailing_ comment - fig_
format_ ⚠capabilities - fig_
keyvalue_ ⚠key - fig_
keyvalue_ ⚠value - 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