Trait im::lens::PartialLens
[−]
[src]
pub trait PartialLens: Clone { type From; type To; fn try_get(&self, s: &Self::From) -> Option<Arc<Self::To>>; fn try_put<Convert>(
&self,
v: Option<Convert>,
s: &Self::From
) -> Option<Self::From>
where
Convert: Shared<Self::To>; 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(&self, s: &Self::From) -> Option<Arc<Self::To>>
Get the focus of the lens, if available.
fn try_put<Convert>(
&self,
v: Option<Convert>,
s: &Self::From
) -> Option<Self::From> where
Convert: Shared<Self::To>,
&self,
v: Option<Convert>,
s: &Self::From
) -> Option<Self::From> where
Convert: Shared<Self::To>,
Put a value into the lens, returning the updated From
value if 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, type From = Map<K, V>; type To = V;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>, type From = A; type To = C;impl<A, B> PartialLens for GeneralLens<A, B> type From = A; type To = B;