pub struct ConvRef<'a, S: ?Sized + 'a, A: ?Sized + 'a = S, T: ?Sized + 'a = S, B: ?Sized + 'a = T> { /* private fields */ }
Expand description
An isomorphism family that handles lossless conversions by shared reference.
Implementations§
Trait Implementations§
Source§impl<'a, S, A, T, B> Lens for ConvRef<'a, S, A, T, B>
impl<'a, S, A, T, B> Lens for ConvRef<'a, S, A, T, B>
fn get(&self, v: Self::InitialSource) -> Self::InitialTarget
Source§impl<'a, S, A, T, B> Lenticuloid for ConvRef<'a, S, A, T, B>
impl<'a, S, A, T, B> Lenticuloid for ConvRef<'a, S, A, T, B>
type InitialSource = &'a S
type InitialTarget = &'a A
type FinalSource = &'a T
type FinalTarget = &'a B
type AtInitial = ConvRef<'a, S, A, S, A>
type AtFinal = ConvRef<'a, T, B, T, B>
fn at_initial(&self) -> Self::AtInitial
fn at_final(&self) -> Self::AtFinal
Source§impl<'a, S, A, T, B> PartialLens for ConvRef<'a, S, A, T, B>
impl<'a, S, A, T, B> PartialLens for ConvRef<'a, S, A, T, B>
fn try_get( &self, v: Self::InitialSource, ) -> Result<Self::InitialTarget, Self::FinalSource>
Source§fn try_get_inject(
&self,
v: Self::InitialSource,
) -> Result<(Self::InitialTarget, Injector<'_, Self::FinalTarget, Self::FinalSource>), Self::FinalSource>
fn try_get_inject( &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 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
fn modify_with<F, X>( &self, v: Self::InitialSource, f: F, ) -> (Self::FinalSource, Option<X>)
Source§impl<'a, S, A, T, B> Prism for ConvRef<'a, S, A, T, B>
impl<'a, S, A, T, B> Prism for ConvRef<'a, S, A, T, B>
fn inject(&self, v: Self::FinalTarget) -> Self::FinalSource
impl<'a, S, A, T, B> Copy for ConvRef<'a, S, A, T, B>
impl<'a, S, A, T, B> Iso for ConvRef<'a, S, A, T, B>
Auto Trait Implementations§
impl<'a, S, A, T, B> Freeze for ConvRef<'a, S, A, T, B>
impl<'a, S, A = S, T = S, B = T> !RefUnwindSafe for ConvRef<'a, S, A, T, B>
impl<'a, S, A = S, T = S, B = T> !Send for ConvRef<'a, S, A, T, B>
impl<'a, S, A = S, T = S, B = T> !Sync for ConvRef<'a, S, A, T, B>
impl<'a, S, A = S, T = S, B = T> !Unpin for ConvRef<'a, S, A, T, B>
impl<'a, S, A = S, T = S, B = T> !UnwindSafe for ConvRef<'a, S, A, T, B>
Blanket Implementations§
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