Skip to main content

Crate fig_sys

Crate fig_sys 

Source
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§

FigClosedContainers
Mirror of FigClosedContainers.
FigCommentDelimiter
Mirror of FigCommentDelimiter.
FigCommentRow
Mirror of FigCommentRow.
FigComments
Mirror of FigComments.
FigDialectDesc
Mirror of FigDialectDesc.
FigDirectiveRow
Mirror of FigDirectiveRow.
FigError
A caller-allocated parse diagnostic. Mirrors FigError in fig.h. Lead with size = size_of::<FigError>(): the library writes only the fields size covers, so it can gain fields in a later release without breaking this layout. byte_offset/line/column are 0 when unknown. A runtime language’s parse failure fills byte_offset with the offset its parser reported; the compiled formats leave all three 0 for now. message is NUL-terminated and truncated to fit; message_len excludes the NUL.
FigKeyValue
A key: value entry for fig_value_map. Mirrors FigKeyValue in fig.h.
FigLanguageVTable
Mirror of FigLanguageVTable. The five render_* slots and print are Option, which is the null pointer on the C side.
FigMentionRow
Mirror of FigMentionRow.
FigNodeRow
Mirror of FigNodeRow.
FigNodeTable
Mirror of FigNodeTable.
FigPathSegment
One step of a path: kind == 0 selects mapping key key_ptr[0..key_len]; kind == 1 selects sequence element index. Mirrors FigPathSegment in fig.h.
FigPrintOptions
Mirror of FigPrintOptions.
FigRegion
FigRegionRow
Mirror of FigRegionRow.
FigRenderRequest
Mirror of FigRenderRequest: everything a renderer is told. fig writes it, and a renderer reads a field only when size covers it.
FigSectionHeader
Mirror of FigSectionHeader.
FigSerializeOptions
Output style for fig_value_serialize_opts/fig_document_serialize. Mirrors FigSerializeOptions in fig.h. ALL trailing fields are declared explicitly (not left to struct padding): with size = size_of the core reads every byte up to size, so an undeclared strip_comments/lossless would otherwise be read out of uninitialized padding.
FigSpan
FigStatus
A fig C ABI status code, as a transparent wrapper over the raw c_int the ABI returns — deliberately not a Rust enum.
FigStr
A borrowed UTF-8 string slice (ptr[0..len]) passed across the C ABI. Mirrors FigStr in fig.h; used for the key list of *_reorder_keys.
FigSyntax
Mirror of FigSyntax.
FigWarning
One lossy event from fig_*_diagnose, pulled by index via fig_*_warning. Caller-allocated; lead with size = size_of::<FigWarning>() (same policy as FigSerializeOptions/FigError). path/note are 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. Mirrors FigWarning in fig.h.

Enums§

FigDocument
FigEditor
FigEmbed
FigEmbedContainer
The container half of an embed selector; every fig_embed_* entry point that selects a region takes one of these beside a FigFormat. The four parametric containers read the format; the three presets pin their own and ignore it. Mirrors FigEmbedContainer in fig.h (ABI 2).
FigFormat
FigNodeKind
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’s max_mapping_depth when 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 a FigFormat variant. 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 $fig envelope.
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_NONE in fig.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’s parent.

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_path means “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 OK the result is an OWNED buffer — release it with fig_free, passing back the exact out_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 from fig_alloc. len must be exact.
fig_keyvalue_key⚠
fig_keyvalue_value⚠
fig_language_register⚠
fig_language_vtable_version⚠
fig_native_ext
With the envelope, the FigExtKind k held 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§

FigFreeBytesFn
FigFreeTableFn
FigNodeId
FigParseFn
FigPrintFn
FigRenderFn
Every render_* slot’s shape.