pub trait RustFsRuntime {
    // Required methods
    fn open(&self, path: &CStr) -> Result<RawFd, FsError>;
    fn read(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize, FsError>;
    fn write(&self, fd: RawFd, buf: &[u8]) -> Result<usize, FsError>;
    fn close(&self, fd: RawFd) -> Result<(), FsError>;
    fn seek(&self, fd: RawFd, pos: SeekFrom) -> Result<usize, FsError>;
}
Expand description

Runtime that implements STD’s FS support. Currently being implemented.

Required Methods§

source

fn open(&self, path: &CStr) -> Result<RawFd, FsError>

Takes in a u128 integer as CStr and emits a File Descriptor that allows File-Like IO on a Twizzler Object. Note that the object must already exist to be opened.

source

fn read(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize, FsError>

Reads bytes from the source twizzler Object into the specified buffer, returns how many bytes were read.

source

fn write(&self, fd: RawFd, buf: &[u8]) -> Result<usize, FsError>

Writes bytes from the source twizzler Object into the specified buffer, returns how many bytes were written.

source

fn close(&self, fd: RawFd) -> Result<(), FsError>

Cleans the data associated with the RawFd allowing reuse. Note that this doesn’t close/unmap the backing object.

source

fn seek(&self, fd: RawFd, pos: SeekFrom) -> Result<usize, FsError>

Moves the cursor to a specified offset within the backed object.

Implementors§