pub struct ArrayCell<T, const N: usize> { /* private fields */ }
Expand description
A Cell<[T; N]>
-like type that has some additional slice-like API.
This type dereferences to SliceCell<T>
.
This type can be converted to and from Cell<[T; N]>
and [Cell<T>; N]
in several ways.
Implementations§
Source§impl<T, const N: usize> ArrayCell<T, N>
impl<T, const N: usize> ArrayCell<T, N>
Sourcepub const fn as_std_ref(&self) -> &Cell<[T; N]>
pub const fn as_std_ref(&self) -> &Cell<[T; N]>
Sourcepub const fn as_std_transposed_ref(&self) -> &[Cell<T>; N]
pub const fn as_std_transposed_ref(&self) -> &[Cell<T>; N]
Sourcepub const fn from_std_ref(std: &Cell<[T; N]>) -> &Self
pub const fn from_std_ref(std: &Cell<[T; N]>) -> &Self
Sourcepub const fn from_std_transposed_ref(std: &[Cell<T>; N]) -> &Self
pub const fn from_std_transposed_ref(std: &[Cell<T>; N]) -> &Self
Sourcepub fn as_std_mut(&mut self) -> &mut Cell<[T; N]>
pub fn as_std_mut(&mut self) -> &mut Cell<[T; N]>
Sourcepub fn as_std_transposed_mut(&mut self) -> &mut [Cell<T>; N]
pub fn as_std_transposed_mut(&mut self) -> &mut [Cell<T>; N]
Sourcepub fn from_std_mut(std: &mut Cell<[T; N]>) -> &mut Self
pub fn from_std_mut(std: &mut Cell<[T; N]>) -> &mut Self
Source§impl<T, const N: usize> ArrayCell<T, N>
impl<T, const N: usize> ArrayCell<T, N>
Sourcepub fn into_std_boxed(self: Box<Self>) -> Box<Cell<[T; N]>>
Available on crate feature alloc
only.
pub fn into_std_boxed(self: Box<Self>) -> Box<Cell<[T; N]>>
alloc
only.Sourcepub fn into_std_transposed_boxed(self: Box<Self>) -> Box<[Cell<T>; N]>
Available on crate feature alloc
only.
pub fn into_std_transposed_boxed(self: Box<Self>) -> Box<[Cell<T>; N]>
alloc
only.Sourcepub fn from_std_boxed(std: Box<Cell<[T; N]>>) -> Box<Self>
Available on crate feature alloc
only.
pub fn from_std_boxed(std: Box<Cell<[T; N]>>) -> Box<Self>
alloc
only.Sourcepub fn from_std_transposed_boxed(std: Box<[Cell<T>; N]>) -> Box<Self>
Available on crate feature alloc
only.
pub fn from_std_transposed_boxed(std: Box<[Cell<T>; N]>) -> Box<Self>
alloc
only.Source§impl<T, const N: usize> ArrayCell<T, N>
impl<T, const N: usize> ArrayCell<T, N>
Sourcepub fn into_std_transposed_rc(self: Rc<Self>) -> Rc<[Cell<T>; N]>
Available on crate feature rc
only.
pub fn into_std_transposed_rc(self: Rc<Self>) -> Rc<[Cell<T>; N]>
rc
only.Sourcepub fn from_std_transposed_rc(std: Rc<[Cell<T>; N]>) -> Rc<Self>
Available on crate feature rc
only.
pub fn from_std_transposed_rc(std: Rc<[Cell<T>; N]>) -> Rc<Self>
rc
only.Sourcepub fn try_new_rc(inner: Rc<[T; N]>) -> Result<Rc<Self>, Rc<[T; N]>>
Available on crate feature rc
only.
pub fn try_new_rc(inner: Rc<[T; N]>) -> Result<Rc<Self>, Rc<[T; N]>>
rc
only.Wraps a reference-counted array in an ArrayCell
, if it is uniquely owned.
Sourcepub fn try_into_inner_rc(self: Rc<Self>) -> Result<Rc<[T; N]>, Rc<Self>>
Available on crate feature rc
only.
pub fn try_into_inner_rc(self: Rc<Self>) -> Result<Rc<[T; N]>, Rc<Self>>
rc
only.Unwraps a reference-counted ArrayCell
into an array, if it is uniquely owned.
Source§impl<T, const N: usize> ArrayCell<T, N>
impl<T, const N: usize> ArrayCell<T, N>
Sourcepub fn as_ptr(&self) -> *mut [T; N]
pub fn as_ptr(&self) -> *mut [T; N]
Returns a raw pointer to the underlying data in this ArrayCell
.
Sourcepub fn into_inner(self) -> [T; N]
pub fn into_inner(self) -> [T; N]
Sourcepub fn from_mut(inner: &mut [T; N]) -> &mut Self
pub fn from_mut(inner: &mut [T; N]) -> &mut Self
Wraps a uniquely borrowed array in an ArrayCell
.
Sourcepub fn get<I: SliceCellIndex<Self>>(&self, idx: I) -> Option<&I::Output>
pub fn get<I: SliceCellIndex<Self>>(&self, idx: I) -> Option<&I::Output>
Returns a reference to an element or subslice depending on the type of index.
See slice::get
.
Sourcepub fn get_mut<I: SliceCellIndex<Self>>(
&mut self,
idx: I,
) -> Option<&mut I::Output>
pub fn get_mut<I: SliceCellIndex<Self>>( &mut self, idx: I, ) -> Option<&mut I::Output>
Returns a mutable reference to an element or subslice depending on the type of index.
See also slice::get_mut
.
Trait Implementations§
Source§impl<'a, T, const N: usize> IntoIterator for &'a ArrayCell<T, N>
impl<'a, T, const N: usize> IntoIterator for &'a ArrayCell<T, N>
Source§impl<'a, T, const N: usize> IntoIterator for &'a mut ArrayCell<T, N>
impl<'a, T, const N: usize> IntoIterator for &'a mut ArrayCell<T, N>
Source§impl<'a, T, const N: usize> TryFrom<Box<SliceCell<T>>> for Box<ArrayCell<T, N>>
Available on crate feature alloc
only.
impl<'a, T, const N: usize> TryFrom<Box<SliceCell<T>>> for Box<ArrayCell<T, N>>
Available on crate feature
alloc
only.impl<T: Send, const N: usize> Send for ArrayCell<T, N>
Auto Trait Implementations§
impl<T, const N: usize> !Freeze for ArrayCell<T, N>
impl<T, const N: usize> !RefUnwindSafe for ArrayCell<T, N>
impl<T, const N: usize> !Sync for ArrayCell<T, N>
impl<T, const N: usize> Unpin for ArrayCell<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for ArrayCell<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