pub struct Alloc<T, A>where
A: Allocator,{ /* private fields */ }Expand description
Implementations§
Trait Implementations§
Source§impl<T, A> RawMem for Alloc<T, A>where
A: Allocator,
impl<T, A> RawMem for Alloc<T, A>where
A: Allocator,
Source§fn allocated(&self) -> &[<Alloc<T, A> as RawMem>::Item]
fn allocated(&self) -> &[<Alloc<T, A> as RawMem>::Item]
Returns a shared slice of all currently initialized elements.
Source§fn allocated_mut(&mut self) -> &mut [<Alloc<T, A> as RawMem>::Item]
fn allocated_mut(&mut self) -> &mut [<Alloc<T, A> as RawMem>::Item]
Returns a mutable slice of all currently initialized elements.
Source§unsafe fn grow(
&mut self,
addition: usize,
fill: impl FnOnce(usize, (&mut [T], &mut [MaybeUninit<T>])),
) -> Result<&mut [T], Error>
unsafe fn grow( &mut self, addition: usize, fill: impl FnOnce(usize, (&mut [T], &mut [MaybeUninit<T>])), ) -> Result<&mut [T], Error>
Low-level growth: extends the memory by
cap elements. Read moreSource§fn shrink(&mut self, cap: usize) -> Result<(), Error>
fn shrink(&mut self, cap: usize) -> Result<(), Error>
Removes the last
cap elements, dropping them.Source§fn size_hint(&self) -> Option<usize>
fn size_hint(&self) -> Option<usize>
Returns an optional hint about the total capacity, if known.
Source§unsafe fn grow_zeroed(&mut self, cap: usize) -> Result<&mut [Self::Item], Error>
unsafe fn grow_zeroed(&mut self, cap: usize) -> Result<&mut [Self::Item], Error>
Grows by
cap elements, zeroing only the uninitialized tail.
Elements already initialized by the backend are preserved. Read moreSource§unsafe fn grow_zeroed_exact(
&mut self,
cap: usize,
) -> Result<&mut [Self::Item], Error>
unsafe fn grow_zeroed_exact( &mut self, cap: usize, ) -> Result<&mut [Self::Item], Error>
Equivalent to
grow_zeroed, preserving initialized elements. Read moreSource§fn grow_with(
&mut self,
addition: usize,
f: impl FnMut() -> Self::Item,
) -> Result<&mut [Self::Item], Error>
fn grow_with( &mut self, addition: usize, f: impl FnMut() -> Self::Item, ) -> Result<&mut [Self::Item], Error>
Grows by
addition elements, calling f only for uninitialized elements.
Elements already initialized by the backend are preserved.Source§unsafe fn grow_with_exact(
&mut self,
addition: usize,
f: impl FnMut() -> Self::Item,
) -> Result<&mut [Self::Item], Error>
unsafe fn grow_with_exact( &mut self, addition: usize, f: impl FnMut() -> Self::Item, ) -> Result<&mut [Self::Item], Error>
Safety Read more
Source§fn grow_filled(
&mut self,
cap: usize,
value: Self::Item,
) -> Result<&mut [Self::Item], Error>
fn grow_filled( &mut self, cap: usize, value: Self::Item, ) -> Result<&mut [Self::Item], Error>
Grows by
cap elements, initializing the uninitialized tail from value.
Elements already initialized by the backend are preserved.Source§unsafe fn grow_filled_exact(
&mut self,
cap: usize,
value: Self::Item,
) -> Result<&mut [Self::Item], Error>
unsafe fn grow_filled_exact( &mut self, cap: usize, value: Self::Item, ) -> Result<&mut [Self::Item], Error>
Safety Read more
Auto Trait Implementations§
impl<T, A> Freeze for Alloc<T, A>
impl<T, A> RefUnwindSafe for Alloc<T, A>where
RawPlace<T>: RefUnwindSafe,
A: RefUnwindSafe,
impl<T, A> Send for Alloc<T, A>
impl<T, A> Sync for Alloc<T, A>
impl<T, A> Unpin for Alloc<T, A>
impl<T, A> UnsafeUnpin for Alloc<T, A>where
RawPlace<T>: UnsafeUnpin,
A: UnsafeUnpin,
impl<T, A> UnwindSafe for Alloc<T, A>where
RawPlace<T>: UnwindSafe,
A: 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
Source§impl<All> ErasedMem for All
impl<All> ErasedMem for All
Source§fn erased_allocated(&self) -> &[<All as ErasedMem>::Item]
fn erased_allocated(&self) -> &[<All as ErasedMem>::Item]
Returns a shared slice of initialized elements (type-erased).
Source§fn erased_allocated_mut(&mut self) -> &mut [<All as ErasedMem>::Item]
fn erased_allocated_mut(&mut self) -> &mut [<All as ErasedMem>::Item]
Returns a mutable slice of initialized elements (type-erased).
Source§unsafe fn erased_grow(
&mut self,
cap: usize,
fill: &mut dyn FillFn<<All as ErasedMem>::Item>,
) -> Result<&mut [<All as ErasedMem>::Item], Error>
unsafe fn erased_grow( &mut self, cap: usize, fill: &mut dyn FillFn<<All as ErasedMem>::Item>, ) -> Result<&mut [<All as ErasedMem>::Item], Error>
Safety Read more
Source§fn erased_shrink(&mut self, cap: usize) -> Result<(), Error>
fn erased_shrink(&mut self, cap: usize) -> Result<(), Error>
Removes the last
cap elements (type-erased).Source§fn erased_size_hint(&self) -> Option<usize>
fn erased_size_hint(&self) -> Option<usize>
Returns an optional capacity hint (type-erased).