pub struct BoxedSlice<T, const N: usize>(/* private fields */);Expand description
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§
Source§impl<T, const N: usize> BoxedSlice<T, N>
impl<T, const N: usize> BoxedSlice<T, N>
Sourcepub fn new(initial_value: T) -> Selfwhere
T: Copy,
pub fn new(initial_value: T) -> Selfwhere
T: Copy,
Create a new BoxedSlice, filling it with the
given initial value.
Trait Implementations§
Source§impl<T, const N: usize> Default for BoxedSlice<T, N>
impl<T, const N: usize> Default for BoxedSlice<T, N>
Source§impl<T, const N: usize> Deref for BoxedSlice<T, N>
impl<T, const N: usize> Deref for BoxedSlice<T, N>
Source§impl<T, const N: usize> DerefMut for BoxedSlice<T, N>
impl<T, const N: usize> DerefMut for BoxedSlice<T, N>
Source§impl<T, F, const N: usize> From<F> for BoxedSlice<T, N>
impl<T, F, const N: usize> From<F> for BoxedSlice<T, N>
impl<T, const N: usize> Eq for BoxedSlice<T, N>where
T: Eq,
Auto Trait Implementations§
impl<T, const N: usize> Freeze for BoxedSlice<T, N>
impl<T, const N: usize> RefUnwindSafe for BoxedSlice<T, N>where
T: RefUnwindSafe,
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>
impl<T, const N: usize> UnwindSafe for BoxedSlice<T, N>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more