RawFileSystem

Struct RawFileSystem 

Source
pub struct RawFileSystem { /* private fields */ }
Expand description

The file system API is located here.

Implementations§

Source§

impl RawFileSystem

Source

pub fn open(&self, path: &str, mode: FileOptions) -> Result<File, Error>

Opens the file at the given path in the given mode. FileOption flags may be OR’d together.

Source

pub fn close(&self, file: &mut File) -> Result<(), Error>

Closes the given file.

Source

pub fn read(&self, file: &mut File, buffer: &mut [u8]) -> Result<u32, Error>

Read data from the given file. The length of the provided buffer determines the length of data read.

Source

pub fn write(&self, file: &mut File, buffer: &[u8]) -> Result<u32, Error>

Write data to the given file. The length of the provided buffer determines the length of data written.

Source

pub fn seek(&self, file: &mut File, offset: u32) -> Result<(), Error>

Move to an offset in the given file. This represents the location within the file for where data is read or written.

Source

pub fn truncate(&self, file: &mut File) -> Result<(), Error>

Truncates the given file.

Source

pub fn sync(&self, file: &mut File) -> Result<(), Error>

Forces a write of all data to storage. Whether this has any effect depends on the driver implementation.

Source

pub fn opendir(&self, path: &str) -> Result<Directory, Error>

Opens a directory. On success, the Directory object is returned.

Source

pub fn closedir(&self, dir: &mut Directory) -> Result<(), Error>

Closes the given directory.

Source

pub fn readdir(&self, dir: &mut Directory) -> Result<FileInfo, Error>

Gets information about items within the given directory. Each call to this function returns the next item in sequence, until a null string is returned.

Source

pub fn findfirst( &self, path: &str, pattern: &str, ) -> Result<(Directory, FileInfo), Error>

Find the first item that matches the given pattern. On success a tuple is returned containing file information and the enclosing directory.

Source

pub fn findnext(&self, dir: &mut Directory) -> Result<FileInfo, Error>

Returns the next item that matches a pattern following a call to findfirst().

Source

pub fn mkdir(&self, path: &str) -> Result<(), Error>

Create a directory at the specified path.

Deletes a file at the specified path.

Source

pub fn rename(&self, old_path: &str, new_path: &str) -> Result<(), Error>

Renames a file at the old path to the new path.

Source

pub fn stat(&self, path: &str) -> Result<FileInfo, Error>

Returns information about a file at the given path.

Source

pub fn chmod( &self, path: &str, attr: FileAttributes, mask: FileAttributes, ) -> Result<(), Error>

Applies the given attributes to the file according to the supplied mask.

Source

pub fn utime(&self, path: &str, timestamp: NaiveDateTime) -> Result<(), Error>

Applies a timestamp to the given file.

Source

pub fn chdir(&self, path: &str) -> Result<(), Error>

Change the current directory to the given path.

Source

pub fn chdrive(&self, path: &str) -> Result<(), Error>

Change the current drive.

Source

pub fn getcwd(&self, buffer: &mut String) -> Result<(), Error>

Retrieves full path name of the current directory of the current drive. The supplied String buffer must have sufficient capacity to read the entire path.

Source

pub fn getfree(&self, path: &str) -> Result<u32, Error>

Get number of free clusters on the drive.

Source

pub fn getlabel(&self, path: &str, label: &mut String) -> Result<u32, Error>

Get the volume label. The supplied String buffer must have sufficient capacity to read the entire label.

Source

pub fn setlabel(&self, label: &str) -> Result<(), Error>

Set the volume label.

Source

pub fn expand(&self, file: &mut File, size: u32) -> Result<(), Error>

Allocate a contiguous block to the given file.

Source

pub fn mount(&mut self) -> Result<(), Error>

Mount the drive.

Source

pub fn mkfs( &self, path: &str, format: FormatOptions, copies: u8, alignment: u32, au_size: u32, root_entries: u32, ) -> Result<(), Error>

Format the drive according to the supplied options.

Source

pub fn setcp(&self, code_page: u16) -> Result<(), Error>

Set the code page.

Source

pub fn putc(&self, file: &mut File, char: u8) -> Result<i32, Error>

Write a character to the file.

Source

pub fn puts(&self, file: &mut File, string: &str) -> Result<i32, Error>

Write a string to the file.

Source

pub fn gets(&self, file: &mut File, buffer: &mut String) -> Result<(), Error>

Get a string from the file. The capacity of the supplied String buffer determines the maximum length of data read.

Source

pub fn unmount(&self, path: &str) -> Result<(), Error>

Unmount the drive at the supplied path.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.