Struct uefi::fs::FileSystem

source ·
pub struct FileSystem<'a>(_);
Available on crate feature alloc only.
Expand description

High-level file-system abstraction for UEFI volumes with an API that is close to std::fs. It acts as convenient accessor around the SimpleFileSystemProtocol.

Implementations§

source§

impl<'a> FileSystem<'a>

source

pub fn new(proto: ScopedProtocol<'a, SimpleFileSystemProtocol>) -> Self

Constructor.

source

pub fn try_exists(&mut self, path: impl AsRef<Path>) -> FileSystemResult<()>

Tests if the underlying file exists. If this returns Ok, the file exists.

source

pub fn copy( &mut self, src_path: impl AsRef<Path>, dest_path: impl AsRef<Path> ) -> FileSystemResult<()>

Copies the contents of one file to another. Creates the destination file if it doesn’t exist and overwrites any content, if it exists.

source

pub fn create_dir(&mut self, path: impl AsRef<Path>) -> FileSystemResult<()>

Creates a new, empty directory at the provided path

source

pub fn create_dir_all(&mut self, path: impl AsRef<Path>) -> FileSystemResult<()>

Recursively create a directory and all of its parent components if they are missing.

source

pub fn metadata( &mut self, path: impl AsRef<Path> ) -> FileSystemResult<Box<UefiFileInfo>>

Given a path, query the file system to get information about a file, directory, etc. Returns UefiFileInfo.

source

pub fn read(&mut self, path: impl AsRef<Path>) -> FileSystemResult<Vec<u8>>

Read the entire contents of a file into a bytes vector.

source

pub fn read_dir( &mut self, path: impl AsRef<Path> ) -> FileSystemResult<UefiDirectoryIter>

Returns an iterator over the entries within a directory.

source

pub fn read_to_string( &mut self, path: impl AsRef<Path> ) -> FileSystemResult<String>

Read the entire contents of a file into a Rust string.

source

pub fn remove_dir(&mut self, path: impl AsRef<Path>) -> FileSystemResult<()>

Removes an empty directory.

source

pub fn remove_dir_all(&mut self, path: impl AsRef<Path>) -> FileSystemResult<()>

Removes a directory at this path, after removing all its contents. Use carefully!

source

pub fn remove_file(&mut self, path: impl AsRef<Path>) -> FileSystemResult<()>

Removes a file from the filesystem.

source

pub fn rename( &mut self, src_path: impl AsRef<Path>, dest_path: impl AsRef<Path> ) -> FileSystemResult<()>

Rename a file or directory to a new name, replacing the original file if it already exists.

source

pub fn write( &mut self, path: impl AsRef<Path>, content: impl AsRef<[u8]> ) -> FileSystemResult<()>

Write a slice as the entire contents of a file. This function will create a file if it does not exist, and will entirely replace its contents if it does.

Trait Implementations§

source§

impl<'a> Debug for FileSystem<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for FileSystem<'a>

§

impl<'a> !Send for FileSystem<'a>

§

impl<'a> !Sync for FileSystem<'a>

§

impl<'a> Unpin for FileSystem<'a>

§

impl<'a> !UnwindSafe for FileSystem<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.