pub struct Zallocator { /* private fields */ }
Expand description
Amortizes the cost of small allocations by allocating memory in bigger chunks.
Implementations§
Source§impl Zallocator
impl Zallocator
Sourcepub fn new(size: usize, tag: &'static str) -> Result<Self>
pub fn new(size: usize, tag: &'static str) -> Result<Self>
Creates an allocator starting with the given size.
Sourcepub fn allocate_aligned(&self, size: u64) -> Result<Buffer>
pub fn allocate_aligned(&self, size: u64) -> Result<Buffer>
Allocate a buffer with according to size
(well-aligned)
Sourcepub fn allocate_aligned_unchecked(&self, size: u64) -> Buffer
pub fn allocate_aligned_unchecked(&self, size: u64) -> Buffer
Allocate a buffer with according to size
(well-aligned) without checking size
§Panics
Size larger than 1 << 30
.
Sourcepub fn allocate_unchecked(&self, size: u64) -> Buffer
pub fn allocate_unchecked(&self, size: u64) -> Buffer
Trait Implementations§
Source§impl Clone for Zallocator
impl Clone for Zallocator
Source§fn clone(&self) -> Zallocator
fn clone(&self) -> Zallocator
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Zallocator
impl Debug for Zallocator
Auto Trait Implementations§
impl Freeze for Zallocator
impl !RefUnwindSafe for Zallocator
impl Send for Zallocator
impl Sync for Zallocator
impl Unpin for Zallocator
impl !UnwindSafe for Zallocator
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