Struct axmem::MemBackend
source · pub struct MemBackend { /* private fields */ }
Expand description
File backend for Lazy load MapArea
. file
should be a file holding a offset value. Normally,
MemBackend
won’t share a file with other things, so we use a Box
here.
Implementations§
source§impl MemBackend
impl MemBackend
sourcepub fn new(file: Box<dyn FileExt>, offset: u64) -> Self
pub fn new(file: Box<dyn FileExt>, offset: u64) -> Self
Create a new MemBackend
with a file and the seek offset of this file.
sourcepub fn clone_with_delta(&self, delta: i64) -> Self
pub fn clone_with_delta(&self, delta: i64) -> Self
clone a new MemBackend
with a delta offset of the file of the original MemBackend
.
sourcepub fn read_from_seek(
&mut self,
pos: SeekFrom,
buf: &mut [u8]
) -> Result<usize, Error>
pub fn read_from_seek( &mut self, pos: SeekFrom, buf: &mut [u8] ) -> Result<usize, Error>
read from the file of the MemBackend
with a pos offset.
Trait Implementations§
source§impl Clone for MemBackend
impl Clone for MemBackend
source§impl Read for MemBackend
impl Read for MemBackend
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read.
source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
Read all bytes until EOF in this source, placing them into
buf
.source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxError>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxError>
Read all bytes until EOF in this source, appending them to
buf
.Auto Trait Implementations§
impl !RefUnwindSafe for MemBackend
impl Send for MemBackend
impl Sync for MemBackend
impl Unpin for MemBackend
impl !UnwindSafe for MemBackend
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