Trait slos_filesystem::FsFileHandle[][src]

pub trait FsFileHandle: Debug {
    fn raw_read(
        &mut self,
        offset: usize,
        length: Option<usize>
    ) -> Result<Vec<u8>, FsError>;
fn raw_write(&mut self, offset: usize, data: &[u8]) -> Result<(), FsError>; }
Expand description

Read/write handle to a FsFile

Required methods

Try to read from the file

Attempts to read length bytes from the offset into the file. If length is None, read from offset to the end of the file.

If the file is write-only, this should return FsError::InvalidArgument.

If the file is only able to be read from as a stream (for example, character devices such as terminals), in the case where offset is non-zero and/or length is not None, this should return FsError::InvalidArgument.

Try to write to the file

Attempts to write the data to the offset into the file, replacing any existing content.

It is implementation-dependent whether this function will truncate the supplied data if it is too large to fit in the file (for example, block devices), however implementations should try to allocate more space on the physical filesystem and extend the file to fit the entire data.

If the file is read-only, this should return FsError::InvalidArgument.

If the file is only able to be written to as a stream (for example, character devices such as terminals), in the case where offset is non-zero, this should return FsError::InvalidArgument.

Implementors