pub struct LensRegistry { /* private fields */ }Expand description
A registry of lenses with a single shared dispatcher.
Implementations§
Source§impl LensRegistry
impl LensRegistry
Sourcepub fn register(&mut self, lens: Lens)
pub fn register(&mut self, lens: Lens)
Register a lens (last registration of an id wins on exact ties).
Sourcepub fn dispatch_view(
&self,
cx: &mut Cx,
target: &Expr,
ctx: &DispatchContext<'_>,
) -> Result<DispatchOutcome>
pub fn dispatch_view( &self, cx: &mut Cx, target: &Expr, ctx: &DispatchContext<'_>, ) -> Result<DispatchOutcome>
Dispatch a View lens for target.
Sourcepub fn dispatch_editor(
&self,
cx: &mut Cx,
target: &Expr,
ctx: &DispatchContext<'_>,
) -> Result<DispatchOutcome>
pub fn dispatch_editor( &self, cx: &mut Cx, target: &Expr, ctx: &DispatchContext<'_>, ) -> Result<DispatchOutcome>
Dispatch an Editor lens for target.
Sourcepub fn dispatch(
&self,
cx: &mut Cx,
kind: LensKind,
target: &Expr,
ctx: &DispatchContext<'_>,
) -> Result<DispatchOutcome>
pub fn dispatch( &self, cx: &mut Cx, kind: LensKind, target: &Expr, ctx: &DispatchContext<'_>, ) -> Result<DispatchOutcome>
Resolve a lens of kind for target per the documented order.
Source§impl LensRegistry
impl LensRegistry
Source§impl LensRegistry
impl LensRegistry
Sourcepub fn render(
&self,
cx: &mut Cx,
lens_id: &Symbol,
value: &Expr,
) -> Result<Expr>
pub fn render( &self, cx: &mut Cx, lens_id: &Symbol, value: &Expr, ) -> Result<Expr>
Render value through the named view lens, validating the emitted Scene.
Source§impl LensRegistry
impl LensRegistry
Sourcepub fn lens_stack(
&self,
cx: &mut Cx,
kind: LensKind,
target: &Expr,
ctx: &DispatchContext<'_>,
) -> Result<Vec<LensStackEntry>>
pub fn lens_stack( &self, cx: &mut Cx, kind: LensKind, target: &Expr, ctx: &DispatchContext<'_>, ) -> Result<Vec<LensStackEntry>>
Build the ordered lens stack of kind for target: every eligible lens
best first, with the universal default last. Capability-denied lenses are
excluded.
Trait Implementations§
Source§impl Default for LensRegistry
impl Default for LensRegistry
Source§fn default() -> LensRegistry
fn default() -> LensRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for LensRegistry
impl !UnwindSafe for LensRegistry
impl Freeze for LensRegistry
impl Send for LensRegistry
impl Sync for LensRegistry
impl Unpin for LensRegistry
impl UnsafeUnpin for LensRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more