[][src]Struct finch::platform::linux::FileSystem

pub struct FileSystem { /* fields omitted */ }

A basic model of the Linux Filesystem

Methods

impl FileSystem[src]

pub fn new(base_path: Option<PathBuf>) -> Result<FileSystem>[src]

Create a new model of the Linux Filesystem.

The filedescriptors 0, 1, and 2 are initialized to files named: /stdin, /stdout, and /stderr respectively.

If given an optional path, then this path will be used to look for files when opening files.

pub fn fd_mut(&mut self, fd: usize) -> Option<&mut FileDescriptor>[src]

Get a mutable reference to a FileDescriptor if it exists.

pub fn fd_seek(
    &mut self,
    fd: usize,
    offset: isize,
    seek: Whence
) -> Result<usize>
[src]

Seek a file descriptor, according to the whence and offset.

pub fn fd_valid(&self, fd: usize) -> bool[src]

Returns true if the file descriptor exists.

pub fn open(&mut self, path: &str) -> Result<Option<usize>>[src]

Attempt to open a file and read it into the filesystem model. Returns a file descriptor if the file exists, or None.

pub fn create(&mut self, path: &str) -> Result<usize>[src]

Open a file, or create it if it does not exist. Returns file descriptor.

pub fn exists(&self, path: &str) -> bool[src]

Return true if a file exists, false otherwise

pub fn zeroize(&mut self, path: &str)[src]

Zeroize the data in a file

pub fn file_bytes(&self, path: &str) -> Option<&[Expression]>[src]

Get data from a file

pub fn file_bytes_mut(&mut self, path: &str) -> Option<&mut Vec<Expression>>[src]

Get a mutable reference to the data for a file

pub fn fd_bytes(&self, fd: usize) -> Option<&[Expression]>[src]

Get the bytes to a file pointed to by a file descriptor

pub fn close_fd(&mut self, fd: usize) -> bool[src]

Close a file descriptor. Returns true if file descriptor existed, false otherwise

pub fn read_fd(
    &mut self,
    fd: usize,
    length: usize
) -> Result<Option<Vec<Expression>>>
[src]

Read from a file descriptor

pub fn write_fd(&mut self, fd: usize, data: Vec<Expression>) -> Result<()>[src]

Write to a file descriptor

pub fn size_fd(&self, fd: usize) -> Option<usize>[src]

Get size of file pointed to by file descriptor

pub fn write(
    &mut self,
    path: &str,
    write_data: Vec<Expression>,
    offset: usize
) -> Result<()>
[src]

Write data into a file at an offset

Trait Implementations

impl Clone for FileSystem[src]

impl Debug for FileSystem[src]

impl<'de> Deserialize<'de> for FileSystem[src]

impl Eq for FileSystem[src]

impl PartialEq<FileSystem> for FileSystem[src]

impl Serialize for FileSystem[src]

impl StructuralEq for FileSystem[src]

impl StructuralPartialEq for FileSystem[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.