pub struct RingAl { /* private fields */ }Expand description
Ring Allocator, see crate level documentation on features and usage
Implementations§
Source§impl RingAl
impl RingAl
Sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Initialize ring allocator with given capacity and default alignment. Allocated capacity
might be different from what was requested, but will contain at least size bytes.
NOTE: not entire capacity will be available for allocation due to guard headers being part of allocations and taking up space as well
Sourcepub fn new_with_align(size: usize, align: usize) -> Self
pub fn new_with_align(size: usize, align: usize) -> Self
Initialize ring allocator with given capacity and alignment. Allocated capacity might be
different from what was requested, but will contain at least size bytes.
NOTE: not entire capacity will be available for allocation due to guard headers being part of allocations and taking up space as well
Sourcepub fn fixed(&mut self, size: usize) -> Option<FixedBufMut>
pub fn fixed(&mut self, size: usize) -> Option<FixedBufMut>
Try to allocate a fixed (non-extandable) buffer with at least
size bytes of capacity, the operation will fail, returning
None, if backing store doesn’t have enough capacity available.
Sourcepub fn extendable(&mut self, size: usize) -> Option<ExtBuf<'_>>
pub fn extendable(&mut self, size: usize) -> Option<ExtBuf<'_>>
Try to allocate an extandable buffer with at least size bytes
of initial capacity, the operation will fail, returning None,
if backing store doesn’t have enough capacity available.
NOTE: the allocated buffer contains an exclusive reference to allocator (used to dynamically grow the buffer), which effectively prevents any further allocations while this buffer is around