Trait refraction::PartialLens
[−]
[src]
pub trait PartialLens: Lenticuloid where
Self::AtInitial: PartialLens,
Self::AtFinal: PartialLens, { fn try_get_inject(
&self,
v: Self::InitialSource
) -> Result<(Self::InitialTarget, Injector<Self::FinalTarget, Self::FinalSource>), Self::FinalSource>; fn modify_with<F, X>(
&self,
v: Self::InitialSource,
f: F
) -> (Self::FinalSource, Option<X>)
where
F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X); fn try_get(
&self,
v: Self::InitialSource
) -> Result<Self::InitialTarget, Self::FinalSource> { ... } fn set(
&self,
v: Self::InitialSource,
x: Self::FinalTarget
) -> Self::FinalSource { ... } fn exchange(
&self,
v: Self::InitialSource,
x: Self::FinalTarget
) -> (Option<Self::InitialTarget>, Self::FinalSource) { ... } fn modify<F>(&self, v: Self::InitialSource, f: F) -> Self::FinalSource
where
F: FnOnce(Self::InitialTarget) -> Self::FinalTarget, { ... } }
The supertype of all partial lens families.
Required Methods
fn try_get_inject(
&self,
v: Self::InitialSource
) -> Result<(Self::InitialTarget, Injector<Self::FinalTarget, Self::FinalSource>), Self::FinalSource>
&self,
v: Self::InitialSource
) -> Result<(Self::InitialTarget, Injector<Self::FinalTarget, Self::FinalSource>), Self::FinalSource>
This signature is somewhat hacky; it awaits resolution of the FnBox
issue for better design. Notably, the injection function returned by
this method will (if law-abiding) only return Some
exactly once;
every time afterwards, it will return None
.
fn modify_with<F, X>(
&self,
v: Self::InitialSource,
f: F
) -> (Self::FinalSource, Option<X>) where
F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X),
&self,
v: Self::InitialSource,
f: F
) -> (Self::FinalSource, Option<X>) where
F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X),
Provided Methods
fn try_get(
&self,
v: Self::InitialSource
) -> Result<Self::InitialTarget, Self::FinalSource>
&self,
v: Self::InitialSource
) -> Result<Self::InitialTarget, Self::FinalSource>
fn set(&self, v: Self::InitialSource, x: Self::FinalTarget) -> Self::FinalSource
fn exchange(
&self,
v: Self::InitialSource,
x: Self::FinalTarget
) -> (Option<Self::InitialTarget>, Self::FinalSource)
&self,
v: Self::InitialSource,
x: Self::FinalTarget
) -> (Option<Self::InitialTarget>, Self::FinalSource)
fn modify<F>(&self, v: Self::InitialSource, f: F) -> Self::FinalSource where
F: FnOnce(Self::InitialTarget) -> Self::FinalTarget,
F: FnOnce(Self::InitialTarget) -> Self::FinalTarget,
Implementors
impl<S, T> PartialLens for Identity<S, T>
impl<LF: PartialLens, LS: ?Sized> PartialLens for Compose<LF, LS> where
LS: PartialLens<InitialTarget = LF::InitialSource, FinalTarget = LF::FinalSource>,
LF::AtInitial: PartialLens,
LF::AtFinal: PartialLens,
LS::AtInitial: PartialLens,
LS::AtFinal: PartialLens,impl<L: Iso> PartialLens for Invert<L> where
L::AtInitial: Iso,
L::AtFinal: Iso,impl<A, B> PartialLens for FromUnit<A, B>
impl<S> PartialLens for ToUnit<S>
impl<S, A, T, B> PartialLens for Conv<S, A, T, B> where
S: Into<A>,
A: Into<S>,
B: Into<T>,
T: Into<B>,impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> PartialLens for ConvRef<'a, S, A, T, B> where
S: AsRef<A> + 'a,
A: AsRef<S> + 'a,
T: AsRef<B> + 'a,
B: AsRef<T> + 'a,impl<'a, S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized> PartialLens for ConvMut<'a, S, A, T, B> where
S: AsMut<A> + 'a,
A: AsMut<S> + 'a,
T: AsMut<B> + 'a,
B: AsMut<T> + 'a,