Skip to main content

MountableFs

Struct MountableFs 

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

A filesystem router that composes multiple backends at different mount points.

Operations are dispatched to the filesystem with the longest matching mount point prefix. If no mount matches, the base filesystem handles the request.

Implementations§

Source§

impl MountableFs

Source

pub fn new(base: impl VirtualFs + 'static) -> Self

Source

pub fn mount(&mut self, mount_path: &str, fs: impl VirtualFs + 'static)

Source

pub fn unmount(&mut self, mount_path: &str)

Trait Implementations§

Source§

impl Debug for MountableFs

Source§

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

Formats the value using the given formatter. Read more
Source§

impl VirtualFs for MountableFs

Source§

fn read_file(&self, file_path: &str) -> Result<Vec<u8>, FsError>

Source§

fn read_file_string(&self, file_path: &str) -> Result<String, FsError>

Source§

fn write_file(&self, file_path: &str, content: &[u8]) -> Result<(), FsError>

Source§

fn append_file(&self, file_path: &str, content: &[u8]) -> Result<(), FsError>

Source§

fn exists(&self, file_path: &str) -> bool

Source§

fn stat(&self, file_path: &str) -> Result<Metadata, FsError>

Source§

fn lstat(&self, file_path: &str) -> Result<Metadata, FsError>

Source§

fn mkdir(&self, dir_path: &str, recursive: bool) -> Result<(), FsError>

Source§

fn readdir(&self, dir_path: &str) -> Result<Vec<DirEntry>, FsError>

Source§

fn rm( &self, file_path: &str, recursive: bool, force: bool, ) -> Result<(), FsError>

Source§

fn cp(&self, src: &str, dest: &str, recursive: bool) -> Result<(), FsError>

Source§

fn mv(&self, src: &str, dest: &str) -> Result<(), FsError>

Source§

fn chmod(&self, file_path: &str, mode: u32) -> Result<(), FsError>

Source§

fn realpath(&self, file_path: &str) -> Result<String, FsError>

Source§

fn touch(&self, file_path: &str) -> Result<(), FsError>

Source§

fn set_times( &self, file_path: &str, mtime: Option<SystemTime>, ) -> Result<(), FsError>

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> Same for T

Source§

type Output = T

Should always be Self
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.