Skip to main content

Crate api_parity_rs

Crate api_parity_rs 

Source
Expand description

Runtime types for the api-parity-rs port plugin.

§How it works

  1. Source code is annotated with #[parity_impl] (on impl blocks) or #[parity(...)] (on free functions). Those macros live in api-parity-rs-macros and are re-exported below.
  2. Each annotation expands to an inventory::submit! { ParityEntry { ... } } call. The inventory crate uses link-time registration: each submit! drops a static into a special section, and inventory::iter::<T>() walks them at runtime. No central registry, no init order, and the stub fn the attribute is attached to never has to be called for the entry to be registered.
  3. A target-crate binary calls dump_to_writer (gated on the serde feature) to serialize the registered entries as a kind=port envelope (per SCHEMA.md) for api-parity to consume.

The crate is intentionally domain-agnostic: ParityEntry::path is just an opaque string. It can name a PySpark API, a REST endpoint, etc.

Re-exports§

pub use inventory;

Structs§

ParityEntry
One row in the port-side inventory. All fields are &'static str so the struct can be built in inventory::submit! (which requires a const-constructible value).

Enums§

Status
Implementation state of a tracked API.

Attribute Macros§

parity
Attribute on a free fn. Used when there’s no enclosing impl block to provide a type prefix; the implementation path becomes module_path!()::fn_name (resolved at compile time of the user crate, since module_path!() expands in place).
parity_impl
Attribute on an impl block. Walks the block’s methods, strips any #[parity(...)] attributes, and emits one inventory::submit! per stripped attribute. The implementation path is Self::fn_name, so the type prefix is auto-derived (the user doesn’t have to repeat it).