Expand description
The C ABI for libasdf, implemented in Rust.
This crate is a thin projection of asdf_core onto libasdf’s exported
C interface. It holds no behaviour of its own: everything here converts
between C representations and the engine’s, and every entry point is
wrapped so that a panic can never unwind into a C caller.
§What lives here versus in C
Almost all of the ABI is expressed directly in Rust. Two things cannot be,
and live in shim.c instead:
- the three variadic entry points (
asdf_file_log,asdf_file_error_common,asdf_value_error_common), because defining variadicextern "C"functions needs unstable Rust; and asdf_ndarray_read_float16_at, because_Float16is unstable and its return ABI differs fromuint16_t’s.
§Headers
The public headers are vendored verbatim from upstream rather than
generated, because several API entry points exist only as _Generic
macros or static inline functions. See include/PROVENANCE.md.
Re-exports§
pub use error_ffi::LogLevel;pub use file_ffi::AsdfFile;pub use file_ffi::AsdfValue;pub use types::AsdfValueErr;pub use types::AsdfValueType;pub use types::asdf_config_t;pub use version_ffi::asdf_version_t;
Modules§
- block_
ffi asdf/block.h: the low-level binary block API.- core_
ext - The core-schema extensions.
- error_
ffi - Error and log plumbing shared with
shim.c. - extension_
ffi asdf/extension.h: the extension mechanism.- file_
ffi asdf/file.h: opening, closing and reading values from a file.- ndarray_
ffi asdf/core/ndarray.handasdf/core/datatype.h.- panic
- Keeping Rust panics from crossing the C boundary.
- parser_
ffi asdf/parser.h,asdf/event.handasdf/yaml.h: the low-level event-based parser.- time_
ffi asdf/core/time.h.- trampoline
- Public names for the four entry points whose bodies must be C.
- types
#[repr(C)]mirrors of libasdf’s public, non-opaque structs.- util_
ffi asdf/util.h: the one entry point that header declares.- value_
ffi asdf/value.h: working with values, mappings and sequences.- version_
ffi asdf/version.h: parsing, copying and freeingasdf_version_t.
Constants§
- LIBASDF_
RS_ VERSION - The library’s own version, exported as
libasdf_version.