pub struct FixedSizeVariantArray<A, T>(_, _)
where
         A: AsRef<[T]>,
         T: FixedSizeVariantType;
Expand description

Wrapper type for fixed size type arrays.

Converting this from/to a Variant is generally more efficient than working on the type directly. This is especially important when deriving Variant trait implementations on custom types.

This wrapper type can hold for example Vec<u8>, Box<[u8]> and similar types.

Implementations§

Trait Implementations§

source§

impl<A: AsRef<[T]> + AsMut<[T]>, T: FixedSizeVariantType> AsMut<[T]> for FixedSizeVariantArray<A, T>

source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<A: AsRef<[T]>, T: FixedSizeVariantType> AsMut<A> for FixedSizeVariantArray<A, T>

source§

fn as_mut(&mut self) -> &mut A

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<A: AsRef<[T]>, T: FixedSizeVariantType> AsRef<[T]> for FixedSizeVariantArray<A, T>

source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A: AsRef<[T]>, T: FixedSizeVariantType> AsRef<A> for FixedSizeVariantArray<A, T>

source§

fn as_ref(&self) -> &A

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, T> Clone for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + Clone, T: FixedSizeVariantType + Clone,

source§

fn clone(&self) -> FixedSizeVariantArray<A, T>

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<A, T> Debug for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + Debug, T: FixedSizeVariantType + Debug,

source§

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

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

impl<A: AsRef<[T]>, T: FixedSizeVariantType> Deref for FixedSizeVariantArray<A, T>

§

type Target = A

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl<A: AsRef<[T]>, T: FixedSizeVariantType> DerefMut for FixedSizeVariantArray<A, T>

source§

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

Mutably dereferences the value.
source§

impl<A: AsRef<[T]>, T: FixedSizeVariantType> From<A> for FixedSizeVariantArray<A, T>

source§

fn from(array: A) -> Self

Converts to this type from the input type.
source§

impl<A: AsRef<[T]> + for<'a> From<&'a [T]>, T: FixedSizeVariantType> FromVariant for FixedSizeVariantArray<A, T>

source§

fn from_variant(variant: &Variant) -> Option<Self>

Tries to extract a value. Read more
source§

impl<A, T> Hash for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + Hash, T: FixedSizeVariantType + Hash,

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<A, T> Ord for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + Ord, T: FixedSizeVariantType + Ord,

source§

fn cmp(&self, other: &FixedSizeVariantArray<A, T>) -> Ordering

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

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

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

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

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

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

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

impl<A, T> PartialEq<FixedSizeVariantArray<A, T>> for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + PartialEq, T: FixedSizeVariantType + PartialEq,

source§

fn eq(&self, other: &FixedSizeVariantArray<A, T>) -> 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<A, T> PartialOrd<FixedSizeVariantArray<A, T>> for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + PartialOrd, T: FixedSizeVariantType + PartialOrd,

source§

fn partial_cmp(&self, other: &FixedSizeVariantArray<A, T>) -> 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<A: AsRef<[T]>, T: FixedSizeVariantType> StaticVariantType for FixedSizeVariantArray<A, T>

source§

fn static_variant_type() -> Cow<'static, VariantTy>

Returns the VariantType corresponding to Self.
source§

impl<A: AsRef<[T]>, T: FixedSizeVariantType> ToVariant for FixedSizeVariantArray<A, T>

source§

fn to_variant(&self) -> Variant

Returns a Variant clone of self.
source§

impl<A, T> Copy for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + Copy, T: FixedSizeVariantType + Copy,

source§

impl<A, T> Eq for FixedSizeVariantArray<A, T>where A: AsRef<[T]> + Eq, T: FixedSizeVariantType + Eq,

source§

impl<A, T> StructuralEq for FixedSizeVariantArray<A, T>where A: AsRef<[T]>, T: FixedSizeVariantType,

source§

impl<A, T> StructuralPartialEq for FixedSizeVariantArray<A, T>where A: AsRef<[T]>, T: FixedSizeVariantType,

Auto Trait Implementations§

§

impl<A, T> RefUnwindSafe for FixedSizeVariantArray<A, T>where A: RefUnwindSafe, T: RefUnwindSafe,

§

impl<A, T> Send for FixedSizeVariantArray<A, T>where A: Send, T: Send,

§

impl<A, T> Sync for FixedSizeVariantArray<A, T>where A: Sync, T: Sync,

§

impl<A, T> Unpin for FixedSizeVariantArray<A, T>where A: Unpin, T: Unpin,

§

impl<A, T> UnwindSafe for FixedSizeVariantArray<A, T>where A: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

const: unstable · source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.