pub enum DirectiveBody {
Bare,
Value(Box<Node>),
NameBody {
name: String,
name_range: TokenRange,
generics: Vec<String>,
body: Box<Node>,
methods: Vec<SchemaMethod>,
schema_no_auto_derives: Vec<String>,
},
Import {
spec: DirectiveImportSpec,
path: String,
path_range: TokenRange,
integrity: Option<IntegrityHash>,
},
Main {
params: Vec<DirectiveMainParam>,
return_type: Option<TypeNode>,
},
}Expand description
The body of a parsed #name ... directive, dispatched per
DirectiveShape.
Variants§
Bare
Value(Box<Node>)
NameBody
Single named declaration: <ident>[<T, ...>] <body-expr> (no colon).
generics carries the optional type-parameter list declared after
the name (e.g. Result<T, E> → ["T", "E"]); empty when absent.
methods and schema_no_auto_derives carry the optional
with { ... } extension block (Phase A of the trait-bound /
schema-method system; see docs/internal/archive/type-constraints-spec.md).
Both are empty when no with block follows the body.
Fields
name_range: TokenRangemethods: Vec<SchemaMethod>Methods declared inside the trailing with { ... } block.
Order preserves source order. Each method may carry method-level
#derive <Constraint> pragmas and an #native flag.
Import
Fields
spec: DirectiveImportSpecpath_range: TokenRangeintegrity: Option<IntegrityHash>Optional integrity pin: #import <spec> from "path" sha256:"...".
When present, the workspace loader verifies the loaded source’s
digest against this value and refuses the import on mismatch.
v3++ b-2 wires sha256 only; the HashAlgorithm enum reserves
space for additional algorithms (sha512, blake3, …) without
churning the AST surface again.
Main
Trait Implementations§
Source§impl Clone for DirectiveBody
impl Clone for DirectiveBody
Source§fn clone(&self) -> DirectiveBody
fn clone(&self) -> DirectiveBody
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DirectiveBody
impl Debug for DirectiveBody
Source§impl PartialEq for DirectiveBody
impl PartialEq for DirectiveBody
Source§fn eq(&self, other: &DirectiveBody) -> bool
fn eq(&self, other: &DirectiveBody) -> bool
self and other values to be equal, and is used by ==.