pub struct DynamicArray<T, TAllocator: Allocator> { /* private fields */ }
Expand description
A #[repr(C)]
variant of the standard vec
struct.
Functionally the same, but with slightly different functionalities.
Implementations§
Source§impl<T, TAllocator: Allocator> DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> DynamicArray<T, TAllocator>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty DynamicArray
.
Sourcepub const fn with_allocator(allocator: TAllocator) -> Self
pub const fn with_allocator(allocator: TAllocator) -> Self
Creates a new, empty DynamicArray
with an allocator.
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 DynamicArray
with capacity and allocator.
This allocates memory only when capacity > 0
.
§Errors
For details see ArrayError
.
Sourcepub fn with_capacity(capacity: Length) -> Result<Self, ArrayError>
pub fn with_capacity(capacity: Length) -> Result<Self, ArrayError>
Creates a new DynamicArray
with capacity and the default allocator.
This allocates memory only when capacity > 0
.
§Errors
For details see ArrayError
.
Trait Implementations§
Source§impl<T, TAllocator: Allocator> BorrowMut<[T]> for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> BorrowMut<[T]> for DynamicArray<T, TAllocator>
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<T, TAllocator: Allocator> Default for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> Default for DynamicArray<T, TAllocator>
Source§impl<T, TAllocator: Allocator> Drop for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> Drop for DynamicArray<T, TAllocator>
Source§impl<T, TAllocator: Allocator> ImmutableArray<T> for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> ImmutableArray<T> for DynamicArray<T, TAllocator>
Source§impl<T, TAllocator: Allocator> Index<Length> for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> Index<Length> for DynamicArray<T, TAllocator>
Source§impl<T, TAllocator: Allocator> IndexMut<Length> for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> IndexMut<Length> for DynamicArray<T, TAllocator>
Source§impl<T, TAllocator: Allocator> MutableArray<T> for DynamicArray<T, TAllocator>
impl<T, TAllocator: Allocator> MutableArray<T> for DynamicArray<T, TAllocator>
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,
impl<T: Eq, TAllocator: Allocator> Eq for DynamicArray<T, TAllocator>
Auto Trait Implementations§
impl<T, TAllocator> Freeze for DynamicArray<T, TAllocator>where
TAllocator: Freeze,
impl<T, TAllocator> RefUnwindSafe for DynamicArray<T, TAllocator>where
TAllocator: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, TAllocator> !Send for DynamicArray<T, TAllocator>
impl<T, TAllocator> !Sync for DynamicArray<T, TAllocator>
impl<T, TAllocator> Unpin for DynamicArray<T, TAllocator>where
TAllocator: Unpin,
impl<T, TAllocator> UnwindSafe for DynamicArray<T, TAllocator>where
TAllocator: UnwindSafe,
T: RefUnwindSafe,
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