pub struct LensMeta {
pub id: Symbol,
pub kind: LensKind,
pub claimed_shapes: Vec<ShapeRef>,
pub claimed_classes: Vec<Symbol>,
pub quality: i32,
pub cost: i32,
pub required_capabilities: Vec<CapabilityName>,
pub preferred_modes: Vec<Symbol>,
pub universal_default: bool,
}Expand description
Open metadata describing a registered lens. Modelled on ExportRecord: a
data record the dispatcher reads, never a closed kernel enum plus a parallel
registry map.
Fields§
§id: SymbolStable lens id (for example view:agent-topology).
kind: LensKindThe role this lens plays.
claimed_shapes: Vec<ShapeRef>Shapes this lens claims; a lens matches a value when one accepts it.
claimed_classes: Vec<Symbol>Class symbols this lens claims as a fallback when no Shape matches.
quality: i32Declared quality; higher wins ties among equally specific matches.
cost: i32Declared cost; lower wins ties after quality.
required_capabilities: Vec<CapabilityName>Capabilities the operator must hold for this lens to be eligible.
preferred_modes: Vec<Symbol>Experience modes this lens prefers (used by mode-aware ranking in P9).
universal_default: boolWhether this is the always-matching universal default of its kind.
Implementations§
Source§impl LensMeta
impl LensMeta
Sourcepub fn new(id: Symbol, kind: LensKind) -> Self
pub fn new(id: Symbol, kind: LensKind) -> Self
Build a minimal lens metadata record with no claims and zero quality and cost. Use the builder methods to fill it in.
Sourcepub fn claiming_shape(self, shape: ShapeRef) -> Self
pub fn claiming_shape(self, shape: ShapeRef) -> Self
Claim a Shape (a shape Value).
Sourcepub fn claiming_class(self, class: Symbol) -> Self
pub fn claiming_class(self, class: Symbol) -> Self
Claim a class symbol as a fallback match.
Sourcepub fn with_quality_cost(self, quality: i32, cost: i32) -> Self
pub fn with_quality_cost(self, quality: i32, cost: i32) -> Self
Set quality and cost.
Sourcepub fn requiring(self, capability: CapabilityName) -> Self
pub fn requiring(self, capability: CapabilityName) -> Self
Require a capability.
Sourcepub fn preferring_mode(self, mode: Symbol) -> Self
pub fn preferring_mode(self, mode: Symbol) -> Self
Prefer an experience mode.
Sourcepub fn as_universal_default(self) -> Self
pub fn as_universal_default(self) -> Self
Mark this lens as the universal default of its kind.