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§

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 (always 0 in this release — offset plumbing is a planned core follow-up). 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.
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.
FigRegion
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.
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
FigEmbedType
FigFormat
FigNodeKind
FigValue

Constants§

FIG_NODE_NONE
Sentinel for “no such node”, matching FIG_NODE_NONE in fig.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

Type Aliases§

FigNodeId