pub struct DynamicArray<T, TAllocator>where
TAllocator: Allocator,{ /* private fields */ }Expand description
A #[repr(C)] variant of the standard vec struct.
Functionally similar, and implements ReprC for T: ReprC.
Implementations§
Source§impl<T, TAllocator> DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> DynamicArray<T, TAllocator>where
TAllocator: Allocator,
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> AsMut<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> AsMut<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> AsRef<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> AsRef<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> Borrow<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> Borrow<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> BorrowMut<[T]> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> BorrowMut<[T]> for DynamicArray<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<T: Clone, TAllocator> Clone for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T: Clone, TAllocator> Clone for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T: Debug, TAllocator> Debug for DynamicArray<T, TAllocator>where
TAllocator: Allocator + Debug,
impl<T: Debug, TAllocator> Debug for DynamicArray<T, TAllocator>where
TAllocator: Allocator + Debug,
Source§impl<T, TAllocator> Default for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> Default for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> Drop for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> Drop for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> Hash for DynamicArray<T, TAllocator>where
T: Hash,
TAllocator: Allocator,
impl<T, TAllocator> Hash for DynamicArray<T, TAllocator>where
T: Hash,
TAllocator: Allocator,
Source§impl<T, TAllocator> ImmutableArray<T> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> ImmutableArray<T> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> Index<Length> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> Index<Length> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> IndexMut<Length> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> IndexMut<Length> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
Source§impl<T, TAllocator> MutableArray<T> for DynamicArray<T, TAllocator>where
TAllocator: Allocator,
impl<T, TAllocator> MutableArray<T> for DynamicArray<T, TAllocator>where
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<T, TAllocator, Rhs> PartialEq<Rhs> for DynamicArray<T, TAllocator>
impl<T, TAllocator, Rhs> PartialEq<Rhs> for DynamicArray<T, TAllocator>
Source§impl<T, TAllocator> ReprC for DynamicArray<T, TAllocator>where
T: ReprC,
TAllocator: Allocator,
impl<T, TAllocator> ReprC for DynamicArray<T, TAllocator>where
T: ReprC,
TAllocator: Allocator,
impl<T, TAllocator> Eq for DynamicArray<T, TAllocator>where
T: Eq,
TAllocator: Allocator,
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>where
T: Send,
impl<T, TAllocator> Sync for DynamicArray<T, TAllocator>where
T: Sync,
impl<T, TAllocator> Unpin for DynamicArray<T, TAllocator>
impl<T, TAllocator> UnsafeUnpin for DynamicArray<T, TAllocator>where
TAllocator: UnsafeUnpin,
impl<T, TAllocator> UnwindSafe for DynamicArray<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