pub struct InlineArray<const TCAPACITY: usize, T, TAllocator>where
T: Sized,
TAllocator: Allocator,{ /* private fields */ }Expand description
Represents a dynamic array, where first TCAPACITY items are inlined in the struct itself.
In other words, this array allocates memory only when its length exceeds TCAPACITY. In which
case it allocates data on heap, and becomes pretty much a DynamicArray.
Implementations§
Source§impl<const TCAPACITY: usize, T, TAllocator> InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty InlineArray with the default TAllocator.
Sourcepub const fn with_allocator(allocator: TAllocator) -> Self
pub const fn with_allocator(allocator: TAllocator) -> Self
Creates a new empty InlineArray with the given TAllocator.
Sourcepub fn with_capacity(capacity: Length) -> Result<Self, ArrayError>
pub fn with_capacity(capacity: Length) -> Result<Self, ArrayError>
Creates a new InlineArray with the default TAllocator. This method allocates memory
if capacity exceeds TCAPACITY.
§Errors
For details see ArrayError.
Sourcepub fn with_capacity_and_allocator(
capacity: Length,
allocator: TAllocator,
) -> Result<Self, ArrayError>
pub fn with_capacity_and_allocator( capacity: Length, allocator: TAllocator, ) -> Result<Self, ArrayError>
Creates a new InlineArray with the given TAllocator. This method allocates memory
if capacity exceeds TCAPACITY.
§Errors
For details see ArrayError.
Trait Implementations§
Source§impl<const TCAPACITY: usize, T, TAllocator> AsMut<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> AsMut<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> AsRef<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> AsRef<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> Borrow<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> Borrow<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> BorrowMut<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> BorrowMut<[T]> for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
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<const TCAPACITY: usize, T: Clone, TAllocator> Clone for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
impl<const TCAPACITY: usize, T: Clone, TAllocator> Clone for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> Default for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> Default for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> Drop for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> Drop for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> Hash for InlineArray<TCAPACITY, T, TAllocator>where
T: Hash,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> Hash for InlineArray<TCAPACITY, T, TAllocator>where
T: Hash,
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> ImmutableArray<T> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> ImmutableArray<T> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> Index<Length> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> Index<Length> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> IndexMut<Length> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> IndexMut<Length> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Source§impl<const TCAPACITY: usize, T, TAllocator> MutableArray<T> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
impl<const TCAPACITY: usize, T, TAllocator> MutableArray<T> for InlineArray<TCAPACITY, T, TAllocator>where
T: Sized,
TAllocator: Allocator,
Source§fn try_push_array<const TSIZE: usize>(
&mut self,
arr: [T; TSIZE],
) -> Result<(), ArrayError>
fn try_push_array<const TSIZE: usize>( &mut self, arr: [T; TSIZE], ) -> Result<(), ArrayError>
Pushes raw array to the array. Read more
Source§fn try_push_slice(&mut self, slice: &[T]) -> Result<(), ArrayError>where
T: Clone,
fn try_push_slice(&mut self, slice: &[T]) -> Result<(), ArrayError>where
T: Clone,
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 as_slice_mut(&mut self) -> &mut [T]
fn as_slice_mut(&mut self) -> &mut [T]
Represents the array as mutable slice.
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: Clone,
fn push_slice(&mut self, slice: &[T])where
T: Clone,
Source§impl<const TCAPACITY: usize, T, TAllocator, Rhs> PartialEq<Rhs> for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator, Rhs> PartialEq<Rhs> for InlineArray<TCAPACITY, T, TAllocator>
Source§impl<const TCAPACITY: usize, T, TAllocator> ReprC for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator> ReprC for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator> Eq for InlineArray<TCAPACITY, T, TAllocator>where
T: Eq,
TAllocator: Allocator,
Auto Trait Implementations§
impl<const TCAPACITY: usize, T, TAllocator> Freeze for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator> RefUnwindSafe for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: RefUnwindSafe,
T: RefUnwindSafe,
impl<const TCAPACITY: usize, T, TAllocator> !Send for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator> !Sync for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator> Unpin for InlineArray<TCAPACITY, T, TAllocator>
impl<const TCAPACITY: usize, T, TAllocator> UnsafeUnpin for InlineArray<TCAPACITY, T, TAllocator>where
TAllocator: UnsafeUnpin,
T: UnsafeUnpin,
impl<const TCAPACITY: usize, T, TAllocator> UnwindSafe for InlineArray<TCAPACITY, T, TAllocator>
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