pub struct RawFileSystem { /* private fields */ }Expand description
The file system API is located here.
Implementations§
Source§impl RawFileSystem
impl RawFileSystem
Sourcepub fn open(&self, path: &str, mode: FileOptions) -> Result<File, Error>
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.
Sourcepub fn read(&self, file: &mut File, buffer: &mut [u8]) -> Result<u32, Error>
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.
Sourcepub fn write(&self, file: &mut File, buffer: &[u8]) -> Result<u32, Error>
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.
Sourcepub fn seek(&self, file: &mut File, offset: u32) -> Result<(), Error>
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.
Sourcepub fn sync(&self, file: &mut File) -> Result<(), Error>
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.
Sourcepub fn opendir(&self, path: &str) -> Result<Directory, Error>
pub fn opendir(&self, path: &str) -> Result<Directory, Error>
Opens a directory. On success, the Directory object is returned.
Sourcepub fn readdir(&self, dir: &mut Directory) -> Result<FileInfo, Error>
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.
Sourcepub fn findfirst(
&self,
path: &str,
pattern: &str,
) -> Result<(Directory, FileInfo), Error>
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.
Sourcepub fn findnext(&self, dir: &mut Directory) -> Result<FileInfo, Error>
pub fn findnext(&self, dir: &mut Directory) -> Result<FileInfo, Error>
Returns the next item that matches a pattern following a call to findfirst().
Sourcepub fn rename(&self, old_path: &str, new_path: &str) -> Result<(), Error>
pub fn rename(&self, old_path: &str, new_path: &str) -> Result<(), Error>
Renames a file at the old path to the new path.
Sourcepub fn stat(&self, path: &str) -> Result<FileInfo, Error>
pub fn stat(&self, path: &str) -> Result<FileInfo, Error>
Returns information about a file at the given path.
Sourcepub fn chmod(
&self,
path: &str,
attr: FileAttributes,
mask: FileAttributes,
) -> Result<(), Error>
pub fn chmod( &self, path: &str, attr: FileAttributes, mask: FileAttributes, ) -> Result<(), Error>
Applies the given attributes to the file according to the supplied mask.
Sourcepub fn utime(&self, path: &str, timestamp: NaiveDateTime) -> Result<(), Error>
pub fn utime(&self, path: &str, timestamp: NaiveDateTime) -> Result<(), Error>
Applies a timestamp to the given file.
Sourcepub fn chdir(&self, path: &str) -> Result<(), Error>
pub fn chdir(&self, path: &str) -> Result<(), Error>
Change the current directory to the given path.
Sourcepub fn getcwd(&self, buffer: &mut String) -> Result<(), Error>
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.
Sourcepub fn getfree(&self, path: &str) -> Result<u32, Error>
pub fn getfree(&self, path: &str) -> Result<u32, Error>
Get number of free clusters on the drive.
Sourcepub fn getlabel(&self, path: &str, label: &mut String) -> Result<u32, Error>
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.
Sourcepub fn expand(&self, file: &mut File, size: u32) -> Result<(), Error>
pub fn expand(&self, file: &mut File, size: u32) -> Result<(), Error>
Allocate a contiguous block to the given file.
Sourcepub fn mkfs(
&self,
path: &str,
format: FormatOptions,
copies: u8,
alignment: u32,
au_size: u32,
root_entries: u32,
) -> Result<(), Error>
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.
Sourcepub fn putc(&self, file: &mut File, char: u8) -> Result<i32, Error>
pub fn putc(&self, file: &mut File, char: u8) -> Result<i32, Error>
Write a character to the file.
Sourcepub fn puts(&self, file: &mut File, string: &str) -> Result<i32, Error>
pub fn puts(&self, file: &mut File, string: &str) -> Result<i32, Error>
Write a string to the file.