pub struct System;Expand description
Adapter exposing the standard System allocator as an forge_alloc_core::Allocator.
System does NOT implement forge_alloc_core::FixedRange (it owns no bounded
region) nor forge_alloc_core::OsBacked (it does not expose page-level controls).
This is intentional — wrappers requiring those traits cannot accidentally
be applied to System.
Implementations§
Trait Implementations§
Source§impl Allocator for System
impl Allocator for System
Source§fn allocate(&self, layout: NonZeroLayout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: NonZeroLayout) -> Result<NonNull<[u8]>, AllocError>
Allocate a block satisfying
layout. The returned slice’s length is
at least layout.size() but may be larger.Source§fn allocate_zeroed(
&self,
layout: NonZeroLayout,
) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed( &self, layout: NonZeroLayout, ) -> Result<NonNull<[u8]>, AllocError>
Allocate a zero-initialized block.
Source§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old: NonZeroLayout,
new: NonZeroLayout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old: NonZeroLayout, new: NonZeroLayout, ) -> Result<NonNull<[u8]>, AllocError>
Grow an allocation in place if possible, otherwise allocate-copy-free. Read more
Source§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old: NonZeroLayout,
new: NonZeroLayout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old: NonZeroLayout, new: NonZeroLayout, ) -> Result<NonNull<[u8]>, AllocError>
Shrink an allocation in place if possible, otherwise allocate-copy-free. Read more
Source§fn reset(&mut self) -> Result<(), AllocError>
fn reset(&mut self) -> Result<(), AllocError>
Reclaim everything previously allocated. Default impl returns
AllocError — only arena-style allocators implement a meaningful
reset. Read moreSource§unsafe fn usable_size(
&self,
_ptr: NonNull<u8>,
_layout: NonZeroLayout,
) -> Option<usize>
unsafe fn usable_size( &self, _ptr: NonNull<u8>, _layout: NonZeroLayout, ) -> Option<usize>
Usable size of an existing allocation, if the allocator can report
it. Defaults to
None — implementors that track usable size
override. Read moreSource§fn capacity_bytes(&self) -> Option<usize>
fn capacity_bytes(&self) -> Option<usize>
Total bytes this allocator can issue, if bounded.
None for unbounded
allocators like System. Used by Watermark to compute thresholds.Source§fn corruption_events(&self) -> u64
fn corruption_events(&self) -> u64
Detected freelist / metadata corruption events observed by this
allocator since construction. Read more
impl Copy for System
Source§impl Deallocator for System
impl Deallocator for System
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: NonZeroLayout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: NonZeroLayout)
Release a previously allocated block. Read more
Auto Trait Implementations§
impl Freeze for System
impl RefUnwindSafe for System
impl Send for System
impl Sync for System
impl Unpin for System
impl UnsafeUnpin for System
impl UnwindSafe for System
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