Skip to main content

Lens

Struct Lens 

Source
pub struct Lens<PO: Strong<S, T>, PI: Strong<A, B>, S, T, A, B>(pub Optic<PO, PI, S, T, A, B>);
Expand description

A Lens is a type of Optic that focuses on a part A of a whole S, allowing both getting the part and setting it (which might change S to T and A to B).

Lenses are typically built from Strong profunctors. This Lens struct wraps an Optic.

Tuple Fields§

§0: Optic<PO, PI, S, T, A, B>

The underlying Optic representation of the lens.

Trait Implementations§

Source§

impl<PO: Strong<S, T>, PI: Strong<A, B>, S, T, A, B> Deref for Lens<PO, PI, S, T, A, B>

Source§

type Target = Optic<PO, PI, S, T, A, B>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Optic<PO, PI, S, T, A, B>

Dereferences the value.
Source§

impl<PA: Strong<S, T>, PB: Strong<A, B>, S: 'static, T: 'static, A: 'static, B: 'static> From<Lens<PA, PB, S, T, A, B>> for Optic<PA, PB, S, T, A, B>

Source§

fn from(value: Lens<PA, PB, S, T, A, B>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<PO, PI, S, T, A, B> !RefUnwindSafe for Lens<PO, PI, S, T, A, B>

§

impl<PO, PI, S, T, A, B> !Send for Lens<PO, PI, S, T, A, B>

§

impl<PO, PI, S, T, A, B> !Sync for Lens<PO, PI, S, T, A, B>

§

impl<PO, PI, S, T, A, B> !UnwindSafe for Lens<PO, PI, S, T, A, B>

§

impl<PO, PI, S, T, A, B> Freeze for Lens<PO, PI, S, T, A, B>
where Optic<PO, PI, S, T, A, B>: Freeze,

§

impl<PO, PI, S, T, A, B> Unpin for Lens<PO, PI, S, T, A, B>
where Optic<PO, PI, S, T, A, B>: Unpin,

§

impl<PO, PI, S, T, A, B> UnsafeUnpin for Lens<PO, PI, S, T, A, B>
where Optic<PO, PI, S, T, A, B>: UnsafeUnpin,

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.