pub struct Allocator { /* private fields */ }Expand description
Stateless API wrapper around CPU memory allocation strategies.
Implementations§
Source§impl Allocator
impl Allocator
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new allocator configured from environment.
Uses LAVA_FLOW_MAX_CPU_ALLOCATION_SIZE when valid and non-zero.
Sourcepub fn with_max_allocation_size(max_allocation_size: usize) -> Self
pub fn with_max_allocation_size(max_allocation_size: usize) -> Self
Creates a new allocator with an explicit allocation cap.
A value of 0 means “use the platform hard limit”.
Sourcepub fn max_allocation_size(&self) -> usize
pub fn max_allocation_size(&self) -> usize
Returns the effective maximum CPU allocation size in bytes.
Sourcepub fn allocate(&self, size: usize) -> Result<MemoryBuffer>
pub fn allocate(&self, size: usize) -> Result<MemoryBuffer>
Allocates standard host memory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Allocator
impl RefUnwindSafe for Allocator
impl Send for Allocator
impl Sync for Allocator
impl Unpin for Allocator
impl UnsafeUnpin for Allocator
impl UnwindSafe for Allocator
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