Skip to main content

Crate asdf

Crate asdf 

Source
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 variadic extern "C" functions needs unstable Rust; and
  • asdf_ndarray_read_float16_at, because _Float16 is unstable and its return ABI differs from uint16_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.h and asdf/core/datatype.h.
panic
Keeping Rust panics from crossing the C boundary.
parser_ffi
asdf/parser.h, asdf/event.h and asdf/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 freeing asdf_version_t.

Constants§

LIBASDF_RS_VERSION
The library’s own version, exported as libasdf_version.