Struct optics::concrete::Compose

source ·
pub struct Compose<K, L>(pub K, pub L);
Expand description

Composed optics of K and L; K is applied first.

Tuple Fields§

§0: K§1: L

Trait Implementations§

source§

impl<K, L, T> AffineFold<T> for Compose<K, L>
where K: AffineFold<T>, K::View: Sized, L: AffineFold<K::View>, L::View: Sized,

source§

fn preview(&self, s: T) -> Result<L::View, Self::Error>

Retrieve the value targeted by an AffineFold.
source§

impl<'a, T: ?Sized, K, L> AffineFoldMut<'a, T> for Compose<K, L>
where K: AffineFoldMut<'a, T>, K::View: 'a, L: AffineFoldMut<'a, K::View>, L::View: 'a,

source§

fn preview_mut(&self, s: &'a mut T) -> Result<&'a mut L::View, Self::Error>

Retrieve a mutable reference the value targeted by an AffineFold.
source§

impl<'a, T: ?Sized, K, L> AffineFoldRef<'a, T> for Compose<K, L>
where K: AffineFoldRef<'a, T>, K::View: 'a, L: AffineFoldRef<'a, K::View>, L::View: 'a,

source§

fn preview_ref(&self, s: &'a T) -> Result<&'a L::View, Self::Error>

Retrieve a shared reference the value targeted by an AffineFold.
source§

impl<K, L, T> AffineTraversal<T> for Compose<K, L>
where K: AffineTraversal<T>, K::View: Sized, L: AffineTraversal<K::View>, L::View: Sized,

source§

fn map(&self, s: &mut T, f: impl FnOnce(&mut L::View))

Restricted version for Setter::over. Custom implementation recommended.
source§

fn set(&self, s: &mut T, a: Self::View)

Apply a setter. No Clone is needed, because this optics is affine.
source§

impl<K: Clone, L: Clone> Clone for Compose<K, L>

source§

fn clone(&self) -> Compose<K, L>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<K: Debug, L: Debug> Debug for Compose<K, L>

source§

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

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

impl<K: Display, L: Display> Display for Compose<K, L>

source§

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

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

impl<K, L, T> Getter<T> for Compose<K, L>
where K: Getter<T>, K::View: Sized, L: Getter<K::View>, L::View: Sized,

source§

fn view(&self, s: T) -> L::View

View the value pointed to by a getter.
source§

impl<'a, T: ?Sized, K, L> GetterMut<'a, T> for Compose<K, L>
where K: GetterMut<'a, T>, K::View: 'a, L: GetterMut<'a, K::View>, L::View: 'a,

source§

fn view_mut(&self, s: &'a mut T) -> &'a mut L::View

Get a mutable reference to the value pointed to by a getter.
source§

impl<'a, T: ?Sized, K, L> GetterRef<'a, T> for Compose<K, L>
where K: GetterRef<'a, T>, K::View: 'a, L: GetterRef<'a, K::View>, L::View: 'a,

source§

fn view_ref(&self, s: &'a T) -> &'a L::View

Get a shared reference to the value pointed to by a getter.
source§

impl<K: Hash, L: Hash> Hash for Compose<K, L>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<K: Optics<T>, L: Optics<K::View>, T: ?Sized> Optics<T> for Compose<K, L>

§

type View = <L as Optics<<K as Optics<T>>::View>>::View

View type for this optics.
source§

impl<K: OpticsFallible, L: OpticsFallible> OpticsFallible for Compose<K, L>

§

type Success = SuccessCompose<<K as OpticsFallible>::Success, <L as OpticsFallible>::Success>

Success type for this optics.
§

type Error = ErrorCompose<<K as OpticsFallible>::Error, <K as OpticsFallible>::Success, <L as OpticsFallible>::Error>

Error type for this optics.
source§

fn success_witness(&self) -> Self::Success

Get a lightweight witness for success.
source§

fn map_fallible<S, F, E, G>(self, f: F, g: G) -> MapFallible<Self, F, G>
where Self: Sized, F: Fn(Self::Success) -> S, G: Fn(Self::Error) -> E,

Map the Success and Error type for this fallible optics.
source§

fn map_success<S, F>(self, f: F) -> MapSuccess<Self, F>
where Self: Sized, F: Fn(Self::Success) -> S,

Map the Success type for this fallible optics.
source§

fn map_error<E, G>(self, g: G) -> MapError<Self, G>
where Self: Sized, G: Fn(Self::Error) -> E,

Map the Error type for this fallible optics.
source§

impl<K: Ord, L: Ord> Ord for Compose<K, L>

source§

fn cmp(&self, other: &Compose<K, L>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<K: PartialEq, L: PartialEq> PartialEq for Compose<K, L>

source§

fn eq(&self, other: &Compose<K, L>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<K: PartialOrd, L: PartialOrd> PartialOrd for Compose<K, L>

source§

fn partial_cmp(&self, other: &Compose<K, L>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<K, L, T> Review<T> for Compose<K, L>
where K: Review<T>, K::View: Sized, L: Review<K::View>, L::View: Sized,

source§

fn review(&self, a: L::View) -> T

Retrieve the value targeted by a review.
source§

impl<K, L, T> Setter<T> for Compose<K, L>
where K: Setter<T>, K::View: Sized, L: Setter<K::View>, L::View: Sized,

source§

fn over(&self, s: &mut T, f: &mut dyn FnMut(&mut L::View))

Apply a setter as a modifier.
source§

impl<K, L, T> Traversal<T> for Compose<K, L>
where K: Traversal<T>, K::View: Sized, L: Traversal<K::View>, L::View: Sized,

source§

fn traverse(&self, s: T, f: &mut dyn FnMut(Self::View))

Evaluate the action from left to right on each element targeted by a Traversal.
source§

fn fold<C>(&self, s: T, init: C, f: impl FnMut(&mut C, Self::View)) -> C

Fold every element targeted by this Traversal into a single result.
source§

fn flatten(&self, s: T) -> Vec<Self::View>

Flatten the elements targeted by this Traversal into a Vec.
source§

impl<K: Copy, L: Copy> Copy for Compose<K, L>

source§

impl<K: Eq, L: Eq> Eq for Compose<K, L>

source§

impl<K, L, T> Iso<T> for Compose<K, L>
where K: Iso<T>, K::View: Sized, L: Iso<K::View>, L::View: Sized,

source§

impl<K, L, T> Lens<T> for Compose<K, L>
where K: Lens<T>, K::View: Sized, L: Lens<K::View>, L::View: Sized,

source§

impl<K, L, T> Prism<T> for Compose<K, L>
where K: Prism<T>, K::View: Sized, L: Prism<K::View>, L::View: Sized,

source§

impl<K, L> StructuralPartialEq for Compose<K, L>

Auto Trait Implementations§

§

impl<K, L> Freeze for Compose<K, L>
where K: Freeze, L: Freeze,

§

impl<K, L> RefUnwindSafe for Compose<K, L>

§

impl<K, L> Send for Compose<K, L>
where K: Send, L: Send,

§

impl<K, L> Sync for Compose<K, L>
where K: Sync, L: Sync,

§

impl<K, L> Unpin for Compose<K, L>
where K: Unpin, L: Unpin,

§

impl<K, L> UnwindSafe for Compose<K, L>
where K: UnwindSafe, L: UnwindSafe,

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<T> ToOwned for T
where T: Clone,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.