Trait csx64::exec::fs::FileHandle[][src]

pub trait FileHandle {
    fn is_interactive(&self) -> bool;
fn read(&mut self, buf: &mut [u8]) -> Result<usize, FileError>;
fn write_all(&mut self, buf: &[u8]) -> Result<(), FileError>;
fn seek(&mut self, pos: SeekFrom) -> Result<u64, FileError>; }

All features of files that are exposed to client programs.

is_readable and is_writable inform the emulator what file permissions should be

Required methods

fn is_interactive(&self) -> bool[src]

A special flag used in the event that read returns zero (see read).

fn read(&mut self, buf: &mut [u8]) -> Result<usize, FileError>[src]

Reads at most enough data to fill buf and returns the number of bytes read. Returning zero implies EOF unless is_interactive is true, in which case the emulator would enter the suspended read state awaiting more data.

fn write_all(&mut self, buf: &[u8]) -> Result<(), FileError>[src]

Writes all the content of buf to the file.

fn seek(&mut self, pos: SeekFrom) -> Result<u64, FileError>[src]

Sets the internal read/write cursor to pos and returns the new absolute position.

Loading content...

Implementors

impl FileHandle for MemoryFile[src]

Loading content...