pub struct InlineFixedArray<const TSIZE: usize, T: Sized> { /* private fields */ }Expand description
A fixed-capacity array. This type is similar to DynamicArray,
except its capacity is fixed at compile time, and doesn’t change at runtime. The “Inline” prefix
indicates that the data is stored inside the struct itself, meaning its size depends on TSIZE.
In particular this type does not require an allocator.
Implementations§
Source§impl<const TSIZE: usize, T: Sized> InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: Sized> InlineFixedArray<TSIZE, T>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new, empty InlineFixedArray.
§Panics
This function will panic if the TSIZE is invalid, i.e.
when either TSIZE is 0 or exceeds [Length::MAX_LENGTH].
Sourcepub const fn length(&self) -> Length
pub const fn length(&self) -> Length
Returns the length of the InlineFixedArray.
pub const fn is_empty(&self) -> bool
Sourcepub const fn capacity(&self) -> Length
pub const fn capacity(&self) -> Length
Returns the capacity of the InlineFixedArray. This is TSIZE
as [Length].
Sourcepub const fn as_slice_const(&self) -> &[T]
pub const fn as_slice_const(&self) -> &[T]
Returns the InlineFixedArray as immutable slice.
Sourcepub const fn as_slice_mut_const(&mut self) -> &mut [T]
pub const fn as_slice_mut_const(&mut self) -> &mut [T]
Returns the InlineFixedArray as mutable slice.
Trait Implementations§
Source§impl<const TSIZE: usize, T: Sized> BorrowMut<[T]> for InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: Sized> BorrowMut<[T]> for InlineFixedArray<TSIZE, T>
Source§fn borrow_mut(&mut self) -> &mut [T]
fn borrow_mut(&mut self) -> &mut [T]
Mutably borrows from an owned value. Read more
Source§impl<'de, const CAPACITY: usize, T: Deserialize<'de>> Deserialize<'de> for InlineFixedArray<CAPACITY, T>
Available on crate feature serde only.
impl<'de, const CAPACITY: usize, T: Deserialize<'de>> Deserialize<'de> for InlineFixedArray<CAPACITY, T>
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<const TSIZE: usize, T: Sized + Eq> Eq for InlineFixedArray<TSIZE, T>
Source§impl<const TSIZE: usize, T: Sized> ImmutableArray<T> for InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: Sized> ImmutableArray<T> for InlineFixedArray<TSIZE, T>
Source§impl<const TSIZE: usize, T: Sized> MutableArray<T> for InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: Sized> MutableArray<T> for InlineFixedArray<TSIZE, T>
Source§fn try_push_array<const TARRSIZE: usize>(
&mut self,
arr: [T; TARRSIZE],
) -> Result<(), ArrayError>
fn try_push_array<const TARRSIZE: usize>( &mut self, arr: [T; TARRSIZE], ) -> Result<(), ArrayError>
Tries to push raw array to the array. Read more
Source§fn try_push_slice(&mut self, slice: &[T]) -> Result<(), ArrayTryCloneError>where
T: TryClone,
fn try_push_slice(&mut self, slice: &[T]) -> Result<(), ArrayTryCloneError>where
T: TryClone,
Source§fn try_pop(&mut self) -> Result<T, ArrayIsEmptyError>
fn try_pop(&mut self) -> Result<T, ArrayIsEmptyError>
Removes element from the top of the array. Read more
Source§fn try_push(&mut self, value: T) -> Result<(), ArrayError>
fn try_push(&mut self, value: T) -> Result<(), ArrayError>
Pushes a single element to the array. Read more
Source§fn push_array<const TSIZE: usize>(&mut self, arr: [T; TSIZE])
fn push_array<const TSIZE: usize>(&mut self, arr: [T; TSIZE])
Pushes raw array to the array. Read more
Source§fn push_slice(&mut self, slice: &[T])where
T: TryClone,
fn push_slice(&mut self, slice: &[T])where
T: TryClone,
Source§impl<const TSIZE: usize, T: Sized + PartialEq, Rhs: AsRef<[T]>> PartialEq<Rhs> for InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: Sized + PartialEq, Rhs: AsRef<[T]>> PartialEq<Rhs> for InlineFixedArray<TSIZE, T>
Source§impl<const TSIZE: usize, T: ReprC + Sized> ReprC for InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: ReprC + Sized> ReprC for InlineFixedArray<TSIZE, T>
impl<const TSIZE: usize, T: Send + Sized> Send for InlineFixedArray<TSIZE, T>
Source§impl<const CAPACITY: usize, T: Serialize> Serialize for InlineFixedArray<CAPACITY, T>
Available on crate feature serde only.
impl<const CAPACITY: usize, T: Serialize> Serialize for InlineFixedArray<CAPACITY, T>
Available on crate feature
serde only.impl<const TSIZE: usize, T: Sync + Sized> Sync for InlineFixedArray<TSIZE, T>
Auto Trait Implementations§
impl<const TSIZE: usize, T> Freeze for InlineFixedArray<TSIZE, T>where
T: Freeze,
impl<const TSIZE: usize, T> RefUnwindSafe for InlineFixedArray<TSIZE, T>where
T: RefUnwindSafe,
impl<const TSIZE: usize, T> Unpin for InlineFixedArray<TSIZE, T>where
T: Unpin,
impl<const TSIZE: usize, T> UnsafeUnpin for InlineFixedArray<TSIZE, T>where
T: UnsafeUnpin,
impl<const TSIZE: usize, T> UnwindSafe for InlineFixedArray<TSIZE, T>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