Struct ConvRef

Source
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§

Source§

impl<'a, S, A, T, B> ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source

pub fn mk() -> Self

Trait Implementations§

Source§

impl<'a, S, A, T, B> Clone for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, S, A, T, B> Debug for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

fn fmt(&self, fm: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, S, A, T, B> Default for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, S, A, T, B> Lens for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

fn get(&self, v: Self::InitialSource) -> Self::InitialTarget

Source§

impl<'a, S, A, T, B> Lenticuloid for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

impl<'a, S, A, T, B> PartialLens for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

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>

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.
Source§

fn set( &self, _v: Self::InitialSource, x: Self::FinalTarget, ) -> Self::FinalSource

Source§

fn exchange( &self, v: Self::InitialSource, x: Self::FinalTarget, ) -> (Option<Self::InitialTarget>, Self::FinalSource)

Source§

fn modify<F>(&self, v: Self::InitialSource, f: F) -> Self::FinalSource
where F: FnOnce(Self::InitialTarget) -> Self::FinalTarget,

Source§

fn modify_with<F, X>( &self, v: Self::InitialSource, f: F, ) -> (Self::FinalSource, Option<X>)
where F: FnOnce(Self::InitialTarget) -> (Self::FinalTarget, X),

Source§

impl<'a, S, A, T, B> Prism for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

fn inject(&self, v: Self::FinalTarget) -> Self::FinalSource

Source§

impl<'a, S, A, T, B> Copy for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Source§

impl<'a, S, A, T, B> Iso for ConvRef<'a, S, A, T, B>
where S: AsRef<A> + 'a + ?Sized, A: AsRef<S> + 'a + ?Sized, T: AsRef<B> + 'a + ?Sized, B: AsRef<T> + 'a + ?Sized,

Auto Trait Implementations§

§

impl<'a, S, A, T, B> Freeze for ConvRef<'a, S, A, T, B>
where S: ?Sized, A: ?Sized, T: ?Sized, B: ?Sized,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<This, Other> ComposeExt<Other> for This
where This: Lenticuloid, Other: Lenticuloid<InitialTarget = <This as Lenticuloid>::InitialSource, FinalTarget = <This as Lenticuloid>::FinalSource>,

Source§

fn compose(self, other: Other) -> Compose<This, Other>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<This> InvertExt for This
where This: Lenticuloid,

Source§

fn invert(self) -> Invert<This>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.