Skip to main content

LensMeta

Struct LensMeta 

Source
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: Symbol

Stable lens id (for example view:agent-topology).

§kind: LensKind

The 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: i32

Declared quality; higher wins ties among equally specific matches.

§cost: i32

Declared 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: bool

Whether this is the always-matching universal default of its kind.

Implementations§

Source§

impl LensMeta

Source

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.

Source

pub fn claiming_shape(self, shape: ShapeRef) -> Self

Claim a Shape (a shape Value).

Source

pub fn claiming_class(self, class: Symbol) -> Self

Claim a class symbol as a fallback match.

Source

pub fn with_quality_cost(self, quality: i32, cost: i32) -> Self

Set quality and cost.

Source

pub fn requiring(self, capability: CapabilityName) -> Self

Require a capability.

Source

pub fn preferring_mode(self, mode: Symbol) -> Self

Prefer an experience mode.

Source

pub fn as_universal_default(self) -> Self

Mark this lens as the universal default of its kind.

Trait Implementations§

Source§

impl Clone for LensMeta

Source§

fn clone(&self) -> LensMeta

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.