Trait vizia::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 index<T>(self, index: usize) -> Index<Self, T>
       where T: 'static,
             Self::Target: Deref<Target = [T]> { ... }
    fn map<O, F>(self, map: F) -> Map<Self, O>
       where O: 'static,
             F: 'static + Fn(&Self::Target) -> O { ... }
    fn map_ref<O, F>(self, map: F) -> MapRef<Self, O>
       where O: 'static,
             F: 'static + Fn(&Self::Target) -> &O { ... }
    fn unwrap<T>(self) -> Then<Self, UnwrapLens<T>>
       where T: 'static,
             Self: Lens<Target = Option<T>> { ... }
    fn into_lens<T>(self) -> Then<Self, IntoLens<Self::Target, T>>
       where T: 'static,
             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 index<T>(self, index: usize) -> Index<Self, T>
where T: 'static, Self::Target: Deref<Target = [T]>,

source

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

source

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

source

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

source

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> LensExt for T
where T: Lens + ?Sized,