pub struct Alloc<T, A: Allocator> { /* private fields */ }Expand description
Implementations§
Trait Implementations§
Source§impl<T, A: Allocator> RawMem for Alloc<T, A>
impl<T, A: Allocator> RawMem for Alloc<T, A>
Source§fn allocated(&self) -> &[Self::Item]
fn allocated(&self) -> &[Self::Item]
Returns a shared slice of all currently initialized elements.
Source§fn allocated_mut(&mut self) -> &mut [Self::Item]
fn allocated_mut(&mut self) -> &mut [Self::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]>
unsafe fn grow( &mut self, addition: usize, fill: impl FnOnce(usize, (&mut [T], &mut [MaybeUninit<T>])), ) -> Result<&mut [T]>
Low-level growth: extends the memory by
cap elements. Read moreSource§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_exact(&mut self, cap: usize) -> Result<&mut [Self::Item]>
unsafe fn grow_zeroed_exact(&mut self, cap: usize) -> Result<&mut [Self::Item]>
Safety Read more
Source§fn grow_with(
&mut self,
addition: usize,
f: impl FnMut() -> Self::Item,
) -> Result<&mut [Self::Item]>
fn grow_with( &mut self, addition: usize, f: impl FnMut() -> Self::Item, ) -> Result<&mut [Self::Item]>
Grows by
addition elements, initializing each with the closure f.Source§unsafe fn grow_with_exact(
&mut self,
addition: usize,
f: impl FnMut() -> Self::Item,
) -> Result<&mut [Self::Item]>
unsafe fn grow_with_exact( &mut self, addition: usize, f: impl FnMut() -> Self::Item, ) -> Result<&mut [Self::Item]>
Safety Read more
Source§fn grow_filled(
&mut self,
cap: usize,
value: Self::Item,
) -> Result<&mut [Self::Item]>
fn grow_filled( &mut self, cap: usize, value: Self::Item, ) -> Result<&mut [Self::Item]>
Grows by
cap elements, each cloned from value.Source§unsafe fn grow_filled_exact(
&mut self,
cap: usize,
value: Self::Item,
) -> Result<&mut [Self::Item]>
unsafe fn grow_filled_exact( &mut self, cap: usize, value: Self::Item, ) -> Result<&mut [Self::Item]>
Safety Read more
Source§fn grow_within<R: RangeBounds<usize>>(
&mut self,
range: R,
) -> Result<&mut [Self::Item]>
fn grow_within<R: RangeBounds<usize>>( &mut self, range: R, ) -> Result<&mut [Self::Item]>
Grows by cloning a sub-range of the currently allocated data.
Auto Trait Implementations§
impl<T, A> Freeze for Alloc<T, A>where
A: Freeze,
impl<T, A> RefUnwindSafe for Alloc<T, A>where
A: RefUnwindSafe,
T: 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
A: UnsafeUnpin,
impl<T, A> UnwindSafe for Alloc<T, A>
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).