Expand description
THE ROOT CATALOG’s resource half: the fields a graph root marks #[ingraph(resource)], what a
deployment configures them through, and the walk that declares them.
#[ingraph::graph]
pub struct Media {
videos: Video,
#[ingraph(resource)]
egemma: Egemma,
#[ingraph(resource(factory))]
pool: Pool,
#[ingraph(resource(factory = "crate::boot::cache"))]
cache: Cache,
#[ingraph(resource(factory = "crate::boot::index", teardown))]
index: Index,
}§ONE namespace, and the field spells the THING
A root’s fields are the deployment’s whole catalog — nodes and resources together — so a resource is written exactly as a node is, the TYPE in the field and the kind in the attribute. Nothing here mints a name: the mount IS the field’s identifier, and two members that would collide collide as two Rust fields, which is a refusal this emission does not have to write.
§The document GROUPS them, and resources is reserved for that
Struct-flat, document-nested: the spine grows one resources field holding a <Root>Resources
block, so a deployment writes [resources.egemma] and every resource’s section is under one
roof. That is what makes resources a reserved mount — a member named resources would be a
second meaning for the same key — and the derive refuses one by name.
§A SECTION is emitted for the resources that HAVE one
ResourceSource::Section is the only source a document can carry, so it is the only one with a
field in the block. A factory resource’s options close over something a document cannot hold —
a runtime handle, an open connection — or are computed by a function the declaration names, and
writing a section for one is refused where the reader is looking at the file: the field does not
exist, and deny_unknown_fields names it.
A root that declares no document-sourced resource at all gets no block and no resources field,
which keeps the emitted spine of every root that has none byte-for-byte what it was. A document
that writes resources at such a root is refused by the same unknown-field rule.
Structs§
- Catalog
- One root’s resource catalog, ready to emit.
- Resource
Field - ONE resource field of a graph root, validated and ready to emit.
Enums§
- Resource
Source - WHERE one declared resource’s options come from — the emitter’s half of the single-source law.
Constants§
- RESERVED_
MOUNT - The mount name the resource block is grouped under, which no member may take.
Functions§
- default_
resources_ name <Root>Resources— the name a root’s own resource block takes.