Struct daybreak::backend::MmapStorage
source · pub struct MmapStorage { /* private fields */ }
Expand description
A backend that uses an nonymous mmap.
The Backend
automatically creates bigger map
on demand using following strategy:
- If new data size allows, multiply size by 2.
- Otherwise new data size is used.
Note that mmap is never shrink back.
Use Backend
methods to read and write into it.
Implementations
sourceimpl MmapStorage
impl MmapStorage
sourcepub fn new() -> BackendResult<Self>
pub fn new() -> BackendResult<Self>
Creates new storage with 1024 bytes.
sourcepub fn with_size(len: usize) -> BackendResult<Self>
pub fn with_size(len: usize) -> BackendResult<Self>
Creates new storage with custom size.
Trait Implementations
sourceimpl Backend for MmapStorage
impl Backend for MmapStorage
sourcefn get_data(&mut self) -> BackendResult<Vec<u8>>
fn get_data(&mut self) -> BackendResult<Vec<u8>>
Read the all data from the backend.
sourcefn put_data(&mut self, data: &[u8]) -> BackendResult<()>
fn put_data(&mut self, data: &[u8]) -> BackendResult<()>
Write the whole slice to the backend.
Auto Trait Implementations
impl RefUnwindSafe for MmapStorage
impl Send for MmapStorage
impl Sync for MmapStorage
impl Unpin for MmapStorage
impl UnwindSafe for MmapStorage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more