Struct FromUnit

Source
pub struct FromUnit<A, B> { /* private fields */ }
Expand description

A Prism to “inject” anything into ().

Implementations§

Source§

impl<A, B> FromUnit<A, B>

Source

pub fn mk() -> Self

Trait Implementations§

Source§

impl<A, B> Clone for FromUnit<A, B>

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, B> Debug for FromUnit<A, B>

Source§

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

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

impl<A, B> Default for FromUnit<A, B>

Source§

fn default() -> Self

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

impl<A, B> Lenticuloid for FromUnit<A, B>

Source§

impl<A, B> PartialLens for FromUnit<A, B>

Source§

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

Source§

fn try_get_inject(&self, v: ()) -> Result<(A, Injector<'_, B, ()>), ()>

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: (), _x: B)

Source§

fn exchange(&self, _v: (), _x: B) -> (Option<A>, ())

Source§

fn modify<F>(&self, v: (), _f: F)
where F: FnOnce(A) -> B,

Source§

fn modify_with<F, X>(&self, _v: (), _f: F) -> ((), Option<X>)
where F: FnOnce(A) -> (B, X),

Source§

impl<A, B> Prism for FromUnit<A, B>

Source§

fn inject(&self, _v: B)

Source§

impl<A, B> Copy for FromUnit<A, B>

Auto Trait Implementations§

§

impl<A, B> Freeze for FromUnit<A, B>

§

impl<A, B> !RefUnwindSafe for FromUnit<A, B>

§

impl<A, B> !Send for FromUnit<A, B>

§

impl<A, B> !Sync for FromUnit<A, B>

§

impl<A, B> !Unpin for FromUnit<A, B>

§

impl<A, B> !UnwindSafe for FromUnit<A, B>

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.