Struct rel_slab_allocator::SlabAllocator
source · [−]pub struct SlabAllocator<'a, U, B: Basis = DefaultBasis> { /* private fields */ }
Implementations
sourceimpl<'a, U, B: Basis> SlabAllocator<'a, U, B>
impl<'a, U, B: Basis> SlabAllocator<'a, U, B>
pub fn try_new_in(bytes: Slot<'a, [u8]>, unique: U) -> Result<Self, SlabError>
pub fn try_from_bytes(
bytes: Slot<'a, [u8]>,
unique: U
) -> Result<Self, SlabError>
pub fn shrink_to_fit(&self) -> usize
pub fn deposit<T>(&self, val: OwnedVal<T, Self>) -> Option<OwnedVal<T, Self>>where
T: DropRaw + Portable,
Self: Singleton,
Trait Implementations
sourceimpl<U, B: Basis> Allocator for SlabAllocator<'_, U, B>
impl<U, B: Basis> Allocator for SlabAllocator<'_, U, B>
sourcefn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Attempts to allocate a block of memory. Read more
sourceunsafe fn deallocate(&self, _ptr: NonNull<u8>, _layout: Layout)
unsafe fn deallocate(&self, _ptr: NonNull<u8>, _layout: Layout)
Deallocates the memory referenced by
ptr
. Read moresourcefn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Behaves like
allocate
, but also ensures that the returned memory is
zero-initialized. Read moresourceunsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
Attempts to extend the memory block. Read more
sourceunsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
Behaves like
grow
, but also ensures that the new contents are set to
zero before being returned. Read moresourceunsafe fn grow_in_place(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_in_place(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
sourceunsafe fn grow_zeroed_in_place(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed_in_place(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
sourceimpl<U, B: Basis> Clone for SlabAllocator<'_, U, B>
impl<U, B: Basis> Clone for SlabAllocator<'_, U, B>
sourceimpl<'a, U, B1, B2> Emplace<RelSlabAllocator<'a, U, B1, B2>, SlabRegion<U>> for SlabAllocator<'a, U, B1>where
U: Unique,
B1: Basis,
B2: Basis,
impl<'a, U, B1, B2> Emplace<RelSlabAllocator<'a, U, B1, B2>, SlabRegion<U>> for SlabAllocator<'a, U, B1>where
U: Unique,
B1: Basis,
B2: Basis,
sourcefn emplaced_meta(
&self
) -> <RelSlabAllocator<'a, U, B1, B2> as Pointee>::Metadata
fn emplaced_meta(
&self
) -> <RelSlabAllocator<'a, U, B1, B2> as Pointee>::Metadata
Returns the metadata of the
T
that this emplaces. Read moresourceunsafe fn emplace_unsized_unchecked(
self,
out: In<Slot<'_, RelSlabAllocator<'a, U, B1, B2>>, SlabRegion<U>>
)
unsafe fn emplace_unsized_unchecked(
self,
out: In<Slot<'_, RelSlabAllocator<'a, U, B1, B2>>, SlabRegion<U>>
)
Emplaces a value into a given slot within some memory region. Read more
sourceimpl<'a, U: Unique, B: Basis> RegionalAllocator for SlabAllocator<'a, U, B>
impl<'a, U: Unique, B: Basis> RegionalAllocator for SlabAllocator<'a, U, B>
type Region = SlabRegion<U>
type Region = SlabRegion<U>
The region type for this allocator.
impl<U, B: Basis> Copy for SlabAllocator<'_, U, B>
impl<'a, U, B1, B2> RelAllocator<RelSlabAllocator<'a, U, B1, B2>> for SlabAllocator<'a, U, B1>where
U: Unique,
B1: Basis,
B2: Basis,
impl<'a, U, B: Basis> Singleton for SlabAllocator<'a, U, B>where
Ref<'a, SlabControl<U, B>>: Singleton,
Auto Trait Implementations
impl<'a, U, B = DefaultBasis> !RefUnwindSafe for SlabAllocator<'a, U, B>
impl<'a, U, B = DefaultBasis> !Send for SlabAllocator<'a, U, B>
impl<'a, U, B = DefaultBasis> !Sync for SlabAllocator<'a, U, B>
impl<'a, U, B> Unpin for SlabAllocator<'a, U, B>
impl<'a, U, B = DefaultBasis> !UnwindSafe for SlabAllocator<'a, U, B>
Blanket Implementations
sourceimpl<T, B> BasisPointee<B> for Twhere
B: Basis,
impl<T, B> BasisPointee<B> for Twhere
B: Basis,
type BasisMetadata = ()
type BasisMetadata = ()
The metadata associated with the pointee in the chosen basis.
type FromNativeError = Infallible
type FromNativeError = Infallible
An error occurred while converting metadata from the native
representation. Read more
type ToNativeError = Infallible
type ToNativeError = Infallible
An error occurred while converting metadata to the native
representation. Read more
sourcefn from_native_metadata(
<T as Pointee>::Metadata
) -> Result<<T as BasisPointee<B>>::BasisMetadata, <T as BasisPointee<B>>::FromNativeError>
fn from_native_metadata(
<T as Pointee>::Metadata
) -> Result<<T as BasisPointee<B>>::BasisMetadata, <T as BasisPointee<B>>::FromNativeError>
Returns the pointer metadata in
B
corresponding to the given native
pointer metadata, or Err
if the conversion failed. Read moresourcefn to_native_metadata(
<T as BasisPointee<B>>::BasisMetadata
) -> Result<<T as Pointee>::Metadata, <T as BasisPointee<B>>::ToNativeError>
fn to_native_metadata(
<T as BasisPointee<B>>::BasisMetadata
) -> Result<<T as Pointee>::Metadata, <T as BasisPointee<B>>::ToNativeError>
Returns the native pointer metadata corresponding to the given pointer
metadata in
B
, or Err
if the conversion failed. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<E, T, R> EmplaceExt<T, R> for Ewhere
E: Emplace<T, R>,
T: DropRaw + Pointee + ?Sized,
R: Region,
impl<E, T, R> EmplaceExt<T, R> for Ewhere
E: Emplace<T, R>,
T: DropRaw + Pointee + ?Sized,
R: Region,
sourcefn emplace_unsized(self, out: In<Slot<'_, T>, R>)
fn emplace_unsized(self, out: In<Slot<'_, T>, R>)
Emplaces a value into a given slot within some memory region. Read more
sourcefn emplace(self, out: In<Slot<'_, T>, R>)
fn emplace(self, out: In<Slot<'_, T>, R>)
Emplaces a sized value into a given slot within some memory region. Read more
sourceunsafe fn emplace_mut_unsized(self, out: In<Slot<'_, T>, R>) -> In<Mut<'_, T>, R>
unsafe fn emplace_mut_unsized(self, out: In<Slot<'_, T>, R>) -> In<Mut<'_, T>, R>
Emplaces a value into a given slot within some memory region and returns
a mutable reference. Read more
sourcefn emplace_mut(self, out: In<Slot<'_, T>, R>) -> In<Mut<'_, T>, R>
fn emplace_mut(self, out: In<Slot<'_, T>, R>) -> In<Mut<'_, T>, R>
Emplaces a sized value into a given slot within some memory region and
returns a mutable reference. Read more