Expand description
Runtime support for the JSON-LD Expandable derive macro.
This crate hosts:
- The
Expandabletrait that the derive macro implements. - The
JsonValuebackend trait abstracting any JSON value type the derive can emit (serde_json::Value,sonic_rs::Value,jstrict::Value, or a user-supplied type). - The
ToJsonValuetrait used by generated code to convert leaf field values into a chosenJsonValuebackend. - Behind the
codegenfeature: the attribute parser, intermediate representation, and codegen used by thejsonld-expandableproc-macro crate (kept here so they can be unit-tested withouttrybuild). Only the derive crate enables the feature; runtime consumers never pull in syn/quote/proc-macro2, and those modules are internal API for the derive, not covered by semver.
Application code rarely depends on this crate directly; instead enable an
expandable* feature on the umbrella jsonld crate, which re-exports both
the derive and this crate (as jsonld::expandable_core). The derive reads
the consuming crate’s manifest and points the code it generates at whichever
of the two that crate depends on, following a renamed dependency to the name
it was given.
§Limitations
The derive does not add trait bounds for generic parameters: a generic
struct would need T: ToJsonValue<V>-style bounds on the generated
impl, which the derive cannot express yet. Deriving on a generic struct
fails with unresolved trait-bound errors; use concrete field types.
Traits§
- Expandable
- Convert
&selfinto the expanded JSON-LD form for the chosen backendV. - Expandable
Language Map - Renders a field tagged
#[jsonld(container = "language")]. - Expandable
Type Value - Field marker for dynamic
@typearrays. - Json
Value - Minimal vocabulary for any JSON value type the derive can construct.
- ToJson
Value - Convert a leaf field value to the chosen
JsonValuebackend.