Skip to main content

Crate weaveffi_model

Crate weaveffi_model 

Source
Expand description

The WeaveFFI API model: everything between an API definition and code generation.

  • ir holds the in-memory IR types that an IDL document or annotated Rust source lowers to, and parse reads the IDL text formats (YAML, JSON, and TOML).
  • rust extracts the IR from annotated Rust source for the proc-macros.
  • validate checks a document against the library’s Identity and builds the one Model every generator consumes.
  • ty, model, abi, plan, errors, and pkg hold the resolved types and type index, the model with every C symbol and ABI signature, the C ABI lowering, the marshalling plan, the error naming policy, and the package identity.
  • contract computes each top-level module’s contract table, one fingerprint per declaration, so a stale binding refuses to load and names what changed.
  • meta is the library metadata: the frames the macro embeds in a producer’s library and the CLI reads back into an Api.

§Features

  • idl (default): the IDL text formats, JSON Schema derivation for the IR types, and fancy miette diagnostics. Without it the crate still provides the IR types, Rust extraction, validation, and the model, which is all the proc-macros need.

Modules§

abi
The canonical WeaveFFI C ABI lowering.
contract
Contract tables: a per-declaration fingerprint of each top-level module’s ABI.
errors
The shared error naming policy.
ir
In-memory intermediate representation: the data model a parsed WeaveFFI IDL document becomes.
meta
Library metadata: the API a Rust producer embeds in its compiled library.
model
The model: the one validated, fully lowered view of an API that every language backend consumes.
parse
Multi-format IDL parsing: turn YAML, JSON, or TOML source text into an Api.
pkg
Package identity: the one source of every name a generated package uses.
plan
The marshalling plan: the language-neutral calling contracts every backend renders, stated once.
rust
Extract the IR of a #[weaveffi::module] tree from its Rust syntax.
ty
The resolved type every backend consumes, the single taxonomy that classifies it for the C ABI and the value-buffer wire format, and the TypeIndex that maps each user type name to its declaration.
validate
IDL validation. This module owns the ValidationError catalog and the validate entry point, which checks an Api against the library’s Identity and builds the one Model every generator consumes. The work is split across submodules: rules (name, type, and shape checks), diagnostic (miette span attachment), and warnings (advisory lints).