Coated

Struct Coated 

Source
#[repr(transparent)]
pub struct Coated<I>(pub I);
Expand description

Coated<I> behaves like I in most respects, but implements NonTuple.

Tuple Fields§

§0: I

Trait Implementations§

Source§

impl<I: Clone> Clone for Coated<I>

Source§

fn clone(&self) -> Coated<I>

Returns a duplicate 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<I> Coat<I> for Coated<I>

Source§

fn coat(self) -> I

Source§

impl<I: Debug> Debug for Coated<I>

Source§

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

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

impl<I: Default> Default for Coated<I>

Source§

fn default() -> Coated<I>

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

impl<I> Deref for Coated<I>

Source§

type Target = I

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<I> DerefMut for Coated<I>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<I: Hash> Hash for Coated<I>

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<I: Index> Index for Coated<I>

Source§

type Size = Coated<<I as Index>::Size>

The run-time representation of the size of an Array<Self, T>. Read more
Source§

fn length(size: Self::Size) -> usize

Returns the number of Ts in an Array<Self, T>.
Source§

fn to_usize(self, size: Self::Size) -> usize

Returns the index (in 0..length()) of Self. Read more
Source§

fn from_usize(size: Self::Size, index: usize) -> (usize, Self)

Returns index / self.length(size) and the Self for which to_usize() returns index % self.length(size).
Source§

fn each(size: Self::Size, f: impl FnMut(Self))

Equivalent to, but often more efficient than, Read more
Source§

fn all(size: impl Isomorphic<Self::Size>) -> All<Self>

Returns a View of the specified size that maps every Self to itself.
Source§

impl<I: PartialEq> PartialEq for Coated<I>

Source§

fn eq(&self, other: &Coated<I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S: Size> Size for Coated<S>

Source§

fn each<I: Index<Size = Self>>(self, f: impl FnMut(I))

An abbreviation for I::each(self, f).
Source§

impl<I: Copy> Copy for Coated<I>

Source§

impl<I: Eq> Eq for Coated<I>

Source§

impl<I> NonTuple for Coated<I>

Source§

impl<I> StructuralPartialEq for Coated<I>

Auto Trait Implementations§

§

impl<I> Freeze for Coated<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for Coated<I>
where I: RefUnwindSafe,

§

impl<I> Send for Coated<I>
where I: Send,

§

impl<I> Sync for Coated<I>
where I: Sync,

§

impl<I> Unpin for Coated<I>
where I: Unpin,

§

impl<I> UnwindSafe for Coated<I>
where I: 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<I> Broadcast<()> for I
where I: Expand,

Source§

type Result = I

The Resulting Index type.
Source§

fn size(self_size: <I as Index>::Size, _: ()) -> <I as Index>::Size

The size of Self::Result, given the sizes of Self and Other.
Source§

fn index(index: I) -> (I, ())

Where each Self::Result maps from in Self and in Other.
Source§

impl<I> Broadcast<I> for I
where I: Index + NonTuple,

Source§

type Result = I

The Resulting Index type.
Source§

fn size( self_size: <I as Index>::Size, other_size: <I as Index>::Size, ) -> <I as Index>::Size

The size of Self::Result, given the sizes of Self and Other.
Source§

fn index(index: I) -> (I, I)

Where each Self::Result maps from in Self and in Other.
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<I> Coat<Coated<I>> for I

Source§

fn coat(self) -> Coated<I>

Source§

impl<I> Coat<I> for I
where I: NonTuple,

Source§

fn coat(self) -> I

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

impl<V, T> View for T
where V: View, T: Deref<Target = V>,

Source§

type I = <V as View>::I

The index type.
Source§

type T = <V as View>::T

The element type.
Source§

fn size(&self) -> <<T as View>::I as Index>::Size

The size of the array.
Source§

fn at(&self, index: <T as View>::I) -> <T as View>::T

Compute the element at index.
Source§

fn len(&self) -> usize

The number of elements in Self.
Source§

fn collect<A>(&self) -> A
where A: NewView<I = Self::I, T = Self::T>,

Materialises this View into a collection of type A, e.g. an Array. Read more
Source§

fn nested(self) -> Nested<Self>
where Self: ViewRef, Self::T: View, <<Self::T as View>::I as Index>::Size: Isomorphic<()>,

Creates a View that represents this nested View. Read more
Source§

fn nested_collect<A>(self, size: <<Self::T as View>::I as Index>::Size) -> A
where Self::T: View, A: NewView<I = (Self::I, <Self::T as View>::I), T = <Self::T as View>::T>,

Materialises this nested View into a collection of type A, e.g. an Array. Read more
Source§

fn each(self, f: impl FnMut(Self::T))

Apply f to every element of this View in turn. Read more
Source§

fn enumerate(self) -> Enumerate<Self>

Creates a View with the same Index type as self such that at(i) returns (i, self.at(i)). Read more
Source§

fn diagonal(self, zero: Self::T) -> Diagonal<Self>

Returns a View that maps (i, i) to t when Self maps i to t. It maps (i, j) to zero if i != j. Read more
Source§

fn map<U: Clone, F>(self, f: F) -> Map<Self, F>
where F: Fn(Self::T) -> U,

Creates a View that applies f to the elements of Self. Read more
Source§

fn compose<V: View<I = Self::T>>(self, other: V) -> Compose<Self, V>

Creates a View that uses self to select elements of other. Read more
Source§

fn concat<V: View<T = Self::T>, I: Index, J: Index>( self, other: V, ) -> Concat<Self, V, I, J>
where Self::I: Isomorphic<(I, usize, J)>, <Self::I as Index>::Size: Isomorphic<(I::Size, usize, J::Size)>, V::I: Isomorphic<(I, usize, J)>, <V::I as Index>::Size: Isomorphic<(I::Size, usize, J::Size)>,

Concatenates self with other along an axis of type usize. Read more
Source§

fn from_usize<I: Index, X: Index, J: Index>( self, from_length: impl FnOnce(usize) -> X::Size, ) -> FromUsize<Self, I, X, J>
where Self::I: Isomorphic<(I, usize, J)>, <Self::I as Index>::Size: Isomorphic<<(I, usize, J) as Index>::Size>,

Replace an axis Indexed by usize with one indexed by X. Read more
Source§

fn to_usize<I: Index, X: Index, J: Index>(self) -> ToUsize<Self, I, X, J>
where Self::I: Isomorphic<(I, X, J)>, <Self::I as Index>::Size: Isomorphic<<(I, X, J) as Index>::Size>,

Replace an axis Indexed by X with one indexed by usize. Read more
Source§

fn insert_one<I: Index, J: Index, K: Index>( self, size: J::Size, ) -> InsertOne<Self, I, J, K>
where Self::I: Isomorphic<(I, K)>, <Self::I as Index>::Size: Isomorphic<(I::Size, K::Size)>,

Insert an axis of type J and length 1. Read more
Source§

fn remove_one<I: Index, J: Index, K: Index>(self) -> RemoveOne<Self, I, J, K>
where Self::I: Isomorphic<(I, J, K)>, <Self::I as Index>::Size: Isomorphic<(I::Size, J::Size, K::Size)>,

Remove an axis of type J and length 1. Read more
Source§

fn map_axis<I: Index, V: View, J: Index>( self, other: V, ) -> MapAxis<Self, I, V, J>
where V::T: Index, Self::I: Isomorphic<(I, V::T, J)>, <Self::I as Index>::Size: Isomorphic<(I::Size, <V::T as Index>::Size, J::Size)>,

Creates a view such that at((i, x, j)) gives self.at((i, other.at(x), j)). Read more
Source§

fn zip<V: View>(self, other: V) -> Zip<Self, V, Pair>
where Self::I: Broadcast<V::I>,

Creates a View that pairs of an element of self and an element of other. Read more
Source§

fn binary<V: View, B>(self, other: V) -> Zip<Self, V, B>
where Self::I: Broadcast<V::I>, B: Binary<Self::T, V::T>,

Creates a View that pairs of an element of self and an element of other, then applies binary operator B. Read more
Source§

fn coat<I>(self) -> Coat<Self, I>
where I: Coat<Self::I> + Index, Self::I: Coat<I>, I::Size: Coat<<Self::I as Index>::Size>, <Self::I as Index>::Size: Coat<I::Size>,

Wrap some of the Indexes of this View in Coated. Read more
Source§

fn iso<J>(self) -> Iso<Self, J>
where J: Isomorphic<Self::I> + Index, J::Size: Isomorphic<<Self::I as Index>::Size>,

Change the index type of this View to an Isomorphic type.
Source§

fn transpose<I: Index, X: Index, Y: Index, J: Index>( self, ) -> Transpose<Self, I, X, Y, J>
where (I, (Y, X), J): Isomorphic<Self::I>, (I::Size, (Y::Size, X::Size), J::Size): Isomorphic<<Self::I as Index>::Size>,

Reorder the indices of this View up to Isomorphic. Read more
Source§

fn row<I: Index, J: Index>(self, i: I) -> Row<Self, I, J>
where (I, J): Isomorphic<Self::I>, (I::Size, J::Size): Isomorphic<<Self::I as Index>::Size>,

Returns a View whose at(j) returns self.at(i, j). Read more
Source§

fn rows<I: Index, J: Index>(&self) -> Rows<&Self, I, J>
where (I, J): Isomorphic<Self::I>, (I::Size, J::Size): Isomorphic<<Self::I as Index>::Size>,

Returns a View whose at(i) returns self.row(i).
Source§

fn column<I: Index, J: Index>(self, j: J) -> Column<Self, I, J>
where (I, J): Isomorphic<Self::I>, (I::Size, J::Size): Isomorphic<<Self::I as Index>::Size>,

Returns a View whose at(i) returns self.at(i, j). Read more
Source§

fn columns<I: Index, J: Index>(&self) -> Columns<&Self, I, J>
where (I, J): Isomorphic<Self::I>, (I::Size, J::Size): Isomorphic<<Self::I as Index>::Size>,

Returns a View whose at(j) returns self.column(j).
Source§

impl<T> ViewMut for T
where T: DerefMut, <T as Deref>::Target: ViewMut,

Source§

fn at_mut(&mut self, index: <T as View>::I) -> &mut <T as View>::T

Mutably borrow the element at index.
Source§

impl<T> ViewRef for T
where T: Deref, <T as Deref>::Target: ViewRef,

Source§

fn at_ref(&self, index: <T as View>::I) -> &<T as View>::T

Borrow the element at index.