Struct Identity

Source
pub struct Identity<S, T> { /* private fields */ }
Expand description

The identity lenticuloid.

Implementations§

Source§

impl<S, T> Identity<S, T>

Source

pub fn mk() -> Self

Trait Implementations§

Source§

impl<S, T> Clone for Identity<S, T>

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<S, T> Debug for Identity<S, T>

Source§

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

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

impl<S, T> Default for Identity<S, T>

Source§

fn default() -> Self

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

impl<S, T> Lens for Identity<S, T>

Source§

fn get(&self, v: S) -> S

Source§

impl<S, T> Lenticuloid for Identity<S, T>

Source§

impl<S, T> PartialLens for Identity<S, T>

Source§

fn try_get(&self, v: S) -> Result<S, T>

Source§

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

fn set(&self, _v: S, x: T) -> T

Source§

fn exchange(&self, v: S, x: T) -> (Option<S>, T)

Source§

fn modify<F: FnOnce(S) -> T>(&self, v: S, f: F) -> T

Source§

fn modify_with<F: FnOnce(S) -> (T, X), X>(&self, v: S, f: F) -> (T, Option<X>)

Source§

impl<S, T> Prism for Identity<S, T>

Source§

fn inject(&self, v: T) -> T

Source§

impl<S, T> Copy for Identity<S, T>

Source§

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 This
where Other: Lenticuloid, This: Lenticuloid<InitialTarget = <Other as Lenticuloid>::InitialSource, FinalTarget = <Other as Lenticuloid>::FinalSource>,

Source§

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

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.