Trait im::lens::PartialLens
[−]
[src]
pub trait PartialLens: Clone { type From; type To; fn try_get<R>(&self, s: R) -> Option<Arc<Self::To>>
where
R: AsRef<Self::From>; fn try_put<Convert, R>(
&self,
v: Option<Convert>,
s: R
) -> Option<Self::From>
where
R: AsRef<Self::From>,
Arc<Self::To>: From<Convert>; fn try_chain<L, Next>(
&self,
next: &L
) -> Compose<Self::From, Self::To, Next, Self, L>
where
L: PartialLens<From = Self::To, To = Next>, { ... } }
A lens from From
to To
where the focus of the lens isn't guaranteed to
exist inside From
. Operations on these lenses therefore return Option
s.
Associated Types
Required Methods
fn try_get<R>(&self, s: R) -> Option<Arc<Self::To>> where
R: AsRef<Self::From>,
R: AsRef<Self::From>,
Get the focus of the lens, if available.
fn try_put<Convert, R>(&self, v: Option<Convert>, s: R) -> Option<Self::From> where
R: AsRef<Self::From>,
Arc<Self::To>: From<Convert>,
R: AsRef<Self::From>,
Arc<Self::To>: From<Convert>,
Put a value into the lens, returning the updated From
value is the
operation succeeded.
Provided Methods
fn try_chain<L, Next>(
&self,
next: &L
) -> Compose<Self::From, Self::To, Next, Self, L> where
L: PartialLens<From = Self::To, To = Next>,
&self,
next: &L
) -> Compose<Self::From, Self::To, Next, Self, L> where
L: PartialLens<From = Self::To, To = Next>,
Compose this lens with a lens from To
to a new type Next
, yielding
a lens from From
to Next
.
Implementors
impl<K, V> PartialLens for MapLens<K, V> where
K: Ord,impl<A, B, C, L, R> PartialLens for Compose<A, B, C, L, R> where
L: PartialLens<From = A, To = B>,
R: PartialLens<From = B, To = C>,