Trait vizia_core::binding::LensExt

source ·
pub trait LensExt: Lens {
    // Provided methods
    fn or<Other>(self, other: Other) -> OrLens<Self, Other>
       where Other: Lens<Target = bool>,
             Self: Lens<Target = bool> { ... }
    fn and<Other>(self, other: Other) -> AndLens<Self, Other>
       where Other: Lens<Target = bool>,
             Self: Lens<Target = bool> { ... }
    fn then<Other>(self, other: Other) -> Then<Self, Other>
       where Other: Lens<Source = Self::Target> { ... }
    fn idx<T>(self, index: usize) -> Index<Self, T>
       where T: 'static,
             Self::Target: Deref<Target = [T]> { ... }
    fn map<O: 'static, F: 'static + Fn(&Self::Target) -> O>(
        self,
        map: F,
    ) -> Map<Self, O> { ... }
    fn map_ref<O: 'static, F: 'static + Fn(&Self::Target) -> &O>(
        self,
        map: F,
    ) -> MapRef<Self, O> { ... }
    fn unwrap<T: 'static>(self) -> Then<Self, UnwrapLens<T>>
       where Self: Lens<Target = Option<T>> { ... }
    fn into_lens<T: 'static>(self) -> Then<Self, IntoLens<Self::Target, T>>
       where Self::Target: Clone + Into<T> { ... }
}
Expand description

Helpers for constructing more complex Lenses.

Provided Methods§

source

fn or<Other>(self, other: Other) -> OrLens<Self, Other>
where Other: Lens<Target = bool>, Self: Lens<Target = bool>,

source

fn and<Other>(self, other: Other) -> AndLens<Self, Other>
where Other: Lens<Target = bool>, Self: Lens<Target = bool>,

source

fn then<Other>(self, other: Other) -> Then<Self, Other>
where Other: Lens<Source = Self::Target>,

Used to construct a lens to some data contained within some other lensed data.

§Example

Binds a label to other_data, which is a field of a struct SomeData, which is a field of the root AppData model:

Binding::new(cx, AppData::some_data.then(SomeData::other_data), |cx, data|{

});
source

fn idx<T>(self, index: usize) -> Index<Self, T>
where T: 'static, Self::Target: Deref<Target = [T]>,

source

fn map<O: 'static, F: 'static + Fn(&Self::Target) -> O>( self, map: F, ) -> Map<Self, O>

source

fn map_ref<O: 'static, F: 'static + Fn(&Self::Target) -> &O>( self, map: F, ) -> MapRef<Self, O>

source

fn unwrap<T: 'static>(self) -> Then<Self, UnwrapLens<T>>
where Self: Lens<Target = Option<T>>,

source

fn into_lens<T: 'static>(self) -> Then<Self, IntoLens<Self::Target, T>>
where Self::Target: Clone + Into<T>,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Lens> LensExt for T