[][src]Struct boxed_slice::BoxedSlice

pub struct BoxedSlice<T, const N: usize>(_);

A boxed slice, with a compile-time constant size.

 use boxed_slice::BoxedSlice;
  
 let answer_slice: BoxedSlice<u8, 42> = BoxedSlice::new(42);

 assert_eq!(answer_slice.len(), 42);
 assert!(answer_slice.iter().all(|num| *num == 42));

 let default_slice: BoxedSlice<u8, 128> = BoxedSlice::default();

 assert_eq!(default_slice.len(), 128);
 assert!(default_slice.iter().all(|num| *num == u8::default()));

Implementations

impl<T, const N: usize> BoxedSlice<T, N>[src]

pub fn new(initial_value: T) -> Self where
    T: Copy
[src]

Create a new BoxedSlice, filling it with the given initial value.

Methods from Deref<Target = Box<[T; N]>>

Trait Implementations

impl<T, const N: usize> AsMut<[T]> for BoxedSlice<T, N>[src]

impl<T, const N: usize> AsRef<[T]> for BoxedSlice<T, N>[src]

impl<T, const N: usize> Clone for BoxedSlice<T, N> where
    T: Clone
[src]

impl<T, const N: usize> Default for BoxedSlice<T, N> where
    T: Default + Copy
[src]

impl<T, const N: usize> Deref for BoxedSlice<T, N>[src]

type Target = Box<[T; N]>

The resulting type after dereferencing.

impl<T, const N: usize> DerefMut for BoxedSlice<T, N>[src]

impl<T, const N: usize> Eq for BoxedSlice<T, N> where
    T: Eq
[src]

impl<T, F, const N: usize> From<F> for BoxedSlice<T, N> where
    F: Into<[T; N]>, 
[src]

impl<T, const N: usize> Hash for BoxedSlice<T, N> where
    T: Hash
[src]

impl<T, const N: usize> PartialEq<BoxedSlice<T, N>> for BoxedSlice<T, N> where
    T: PartialEq
[src]

Auto Trait Implementations

impl<T, const N: usize> Send for BoxedSlice<T, N> where
    T: Send

impl<T, const N: usize> Sync for BoxedSlice<T, N> where
    T: Sync

impl<T, const N: usize> Unpin for BoxedSlice<T, N>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.