Trait im::lens::Lens [] [src]

pub trait Lens: PartialLens {
    fn get<R>(&self, s: R) -> Arc<Self::To>
    where
        R: AsRef<Self::From>
, { ... } fn put<Convert, R>(&self, v: Convert, s: R) -> Self::From
    where
        R: AsRef<Self::From>,
        Arc<Self::To>: From<Convert>
, { ... } fn chain<L, Next>(
        &self,
        next: &L
    ) -> Compose<Self::From, Self::To, Next, Self, L>
    where
        L: Lens<From = Self::To, To = Next>
, { ... } }

A lens from From to To where From is guaranteed to contain the focus of the lens (ie. get and put operations cannot fail).

These must also implement PartialLens, so a default implementation is provided which will just unwrap the results of try_get and try_put.

Provided Methods

Get the focus of the lens.

Put a value into the lens, returning the updated From value.

Compose this lens with a lens from To to a new type Next, yielding a lens from From to Next.

Implementors