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§

§

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

pub fn into_inner(self) -> A

Trait Implementations§

§

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

§

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

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

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

§

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

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

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

§

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

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

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

§

fn as_ref(&self) -> &A

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

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

§

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
§

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

§

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

Formats the value using the given formatter. Read more
§

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

§

type Target = A

The resulting type after dereferencing.
§

fn deref(&self) -> &<FixedSizeVariantArray<A, T> as Deref>::Target

Dereferences the value.
§

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

§

fn deref_mut(&mut self) -> &mut <FixedSizeVariantArray<A, T> as Deref>::Target

Mutably dereferences the value.
§

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

§

fn from(array: A) -> FixedSizeVariantArray<A, T>

Converts to this type from the input type.
§

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

§

fn from_variant(variant: &Variant) -> Option<FixedSizeVariantArray<A, T>>

Tries to extract a value. Read more
§

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

§

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

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
§

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

§

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
§

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

§

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

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

§

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
§

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

§

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

Returns the VariantType corresponding to Self.
§

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

§

fn to_variant(&self) -> Variant

Returns a Variant clone of self.
§

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

§

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

§

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

§

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
§

impl<T> AnyEq for Twhere T: Any + PartialEq<T>,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

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.

§

impl<T> FromFd for Twhere T: From<OwnedFd>,

§

fn from_fd(owned_fd: OwnedFd) -> T

👎Deprecated since 1.0.0: FromFd::from_fd is replaced by From<OwnedFd>::from
Constructs a new instance of Self from the given file descriptor. Read more
§

fn from_into_fd<Owned>(into_owned: Owned) -> Selfwhere Owned: Into<OwnedFd>, Self: Sized + From<OwnedFd>,

Constructs a new instance of Self from the given file descriptor converted from into_owned. Read more
§

impl<T> FromFilelike for Twhere T: From<OwnedFd>,

§

fn from_filelike(owned: OwnedFd) -> T

Constructs a new instance of Self from the given filelike object. Read more
§

fn from_into_filelike<Owned>(owned: Owned) -> Twhere Owned: IntoFilelike,

Constructs a new instance of Self from the given filelike object converted from into_owned. Read more
§

impl<T> FromSocketlike for Twhere T: From<OwnedFd>,

§

fn from_socketlike(owned: OwnedFd) -> T

Constructs a new instance of Self from the given socketlike object.
§

fn from_into_socketlike<Owned>(owned: Owned) -> Twhere Owned: IntoSocketlike,

Constructs a new instance of Self from the given socketlike object converted from into_owned.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> RoundFrom<T> for T

§

fn round_from(x: T) -> T

Performs the conversion.
§

impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,

§

fn round_into(self) -> U

Performs the conversion.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more