Trait sgx_rsrvmm::map::Map

source ·
pub trait Map: Any {
    // Required methods
    fn read_at(&self, buf: &mut [u8], offset: usize) -> OsResult<usize>;
    fn write_at(&self, buf: &[u8], offset: usize) -> OsResult<usize>;
    fn flush(&self) -> OsResult;
}

Required Methods§

source

fn read_at(&self, buf: &mut [u8], offset: usize) -> OsResult<usize>

Reads a number of bytes starting from a given offset.

Returns the number of bytes read.

The offset is relative to the start of the file and thus independent from the current cursor.

The current file cursor is not affected by this function.

Note that similar to [File::read], it is not an error to return with a short read.

source

fn write_at(&self, buf: &[u8], offset: usize) -> OsResult<usize>

Writes a number of bytes starting from a given offset.

Returns the number of bytes written.

The offset is relative to the start of the file and thus independent from the current cursor.

The current file cursor is not affected by this function.

When writing beyond the end of the file, the file is appropriately extended and the intermediate bytes are initialized with the value 0.

Note that similar to [File::write], it is not an error to return a short write.

source

fn flush(&self) -> OsResult

Flush this map obejct, ensuring that all intermediately buffered contents reach their destination.

Implementations on Foreign Types§

source§

impl Map for ()

source§

fn read_at(&self, buf: &mut [u8], _offset: usize) -> OsResult<usize>

source§

fn write_at(&self, buf: &[u8], _offset: usize) -> OsResult<usize>

source§

fn flush(&self) -> OsResult

Implementors§