pub struct Registered { /* private fields */ }Expand description
A primitive as registered: the payload, plus the policy a visibility decision is made from.
§Why the two are one value
PrimitiveMeta is derived from the payload — that is what stops a tool
carrying an outputSchema from being filed as needing nothing — but two of
the three inputs to a visibility decision are not derivable. A tool’s
required scopes are a statement by whoever registered it, not a fact about
its schema, and a resource’s required features depend on the revision it is
for.
So the snapshot stores a Registered, not a Primitive. One value means
the listing and the lookup cannot return a payload with one policy and a
neighbour with another, and a PrimitiveMeta is never handed to
is_visible that was not stored beside the payload it
describes.
The derived half and the declared half are merged once, at construction.
From then on there is a single set of requirements per primitive, and
requires adds to the derived set rather than replacing it.
Implementations§
Source§impl Registered
impl Registered
Sourcepub fn new(primitive: Primitive) -> Self
pub fn new(primitive: Primitive) -> Self
Registers primitive with no requirements beyond the derived ones.
Sourcepub const fn id(&self) -> &PrimitiveId
pub const fn id(&self) -> &PrimitiveId
The key this is filed under.
Sourcepub const fn kind(&self) -> PrimitiveKind
pub const fn kind(&self) -> PrimitiveKind
Which list this belongs to.
Sourcepub const fn meta(&self) -> &PrimitiveMeta
pub const fn meta(&self) -> &PrimitiveMeta
The requirements a visibility decision is made from.
Sourcepub const fn requiring(self, features: FeatureSet) -> Self
pub const fn requiring(self, features: FeatureSet) -> Self
Adds to the required features rather than replacing them.
Sourcepub const fn requiring_scope(self, scope: Scope) -> Self
pub const fn requiring_scope(self, scope: Scope) -> Self
Adds to the required scopes rather than replacing them.