pub struct Stash {
buffers: UnsafeCell<Vec<Vec<u8>>>,
mmaps: UnsafeCell<Vec<Mmap>>,
}
Expand description
A simple arena allocator for byte buffers.
Fields§
§buffers: UnsafeCell<Vec<Vec<u8>>>
§mmaps: UnsafeCell<Vec<Mmap>>
Implementations§
source§impl Stash
impl Stash
pub fn new() -> Stash
sourcepub fn allocate(&self, size: usize) -> &mut [u8] ⓘ
pub fn allocate(&self, size: usize) -> &mut [u8] ⓘ
Allocates a buffer of the specified size and returns a mutable reference to it.
sourcepub fn cache_mmap(&self, map: Mmap) -> &[u8] ⓘ
pub fn cache_mmap(&self, map: Mmap) -> &[u8] ⓘ
Stores a Mmap
for the lifetime of this Stash
, returning a pointer
which is scoped to just this lifetime.
Auto Trait Implementations§
impl !Freeze for Stash
impl !RefUnwindSafe for Stash
impl !Send for Stash
impl !Sync for Stash
impl Unpin for Stash
impl UnwindSafe for Stash
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