pub struct Identity<S, T> { /* private fields */ }
Expand description
The identity lenticuloid.
Implementations§
Trait Implementations§
Source§impl<S, T> Lenticuloid for Identity<S, T>
impl<S, T> Lenticuloid for Identity<S, T>
Source§impl<S, T> PartialLens for Identity<S, T>
impl<S, T> PartialLens for Identity<S, T>
fn try_get(&self, v: S) -> Result<S, T>
Source§fn try_get_inject(&self, v: S) -> Result<(S, Injector<'_, T, T>), T>
fn try_get_inject(&self, v: S) -> Result<(S, Injector<'_, T, T>), T>
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 set(&self, _v: S, x: T) -> T
fn exchange(&self, v: S, x: T) -> (Option<S>, T)
fn modify<F: FnOnce(S) -> T>(&self, v: S, f: F) -> T
fn modify_with<F: FnOnce(S) -> (T, X), X>(&self, v: S, f: F) -> (T, Option<X>)
impl<S, T> Copy for Identity<S, T>
impl<S, T> Iso for Identity<S, T>
Auto Trait Implementations§
impl<S, T> Freeze for Identity<S, T>
impl<S, T> !RefUnwindSafe for Identity<S, T>
impl<S, T> !Send for Identity<S, T>
impl<S, T> !Sync for Identity<S, T>
impl<S, T> !Unpin for Identity<S, T>
impl<S, T> !UnwindSafe for Identity<S, T>
Blanket Implementations§
Source§impl<This, Other> AndThenExt<Other> for Thiswhere
Other: Lenticuloid,
This: Lenticuloid<InitialTarget = <Other as Lenticuloid>::InitialSource, FinalTarget = <Other as Lenticuloid>::FinalSource>,
impl<This, Other> AndThenExt<Other> for Thiswhere
Other: Lenticuloid,
This: Lenticuloid<InitialTarget = <Other as Lenticuloid>::InitialSource, FinalTarget = <Other as Lenticuloid>::FinalSource>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more