pub struct Fs { /* private fields */ }Expand description
Cloneable filesystem handle rooted at a jail directory.
Implementations§
Source§impl Fs
impl Fs
Sourcepub fn new(root: impl Into<PathBuf>) -> FsPlugin
pub fn new(root: impl Into<PathBuf>) -> FsPlugin
Builder for FsPlugin (installed via app.install).
pub fn root(&self) -> &Path
pub async fn exists(&self, path: &str) -> Result<bool, FsError>
pub async fn metadata(&self, path: &str) -> Result<FsMeta, FsError>
pub async fn read(&self, path: &str) -> Result<Vec<u8>, FsError>
pub async fn read_to_string(&self, path: &str) -> Result<String, FsError>
pub async fn write( &self, path: &str, data: impl AsRef<[u8]>, ) -> Result<(), FsError>
pub async fn write_string( &self, path: &str, data: impl AsRef<str>, ) -> Result<(), FsError>
pub async fn append( &self, path: &str, data: impl AsRef<[u8]>, ) -> Result<(), FsError>
pub async fn create_dir(&self, path: &str) -> Result<(), FsError>
pub async fn remove_file(&self, path: &str) -> Result<(), FsError>
pub async fn remove_dir(&self, path: &str) -> Result<(), FsError>
pub async fn copy(&self, from: &str, to: &str) -> Result<(), FsError>
pub async fn rename(&self, from: &str, to: &str) -> Result<(), FsError>
pub async fn read_dir(&self, path: &str) -> Result<Vec<FsEntry>, FsError>
pub async fn walk(&self, path: &str) -> Result<Vec<FsEntry>, FsError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Fs
impl RefUnwindSafe for Fs
impl Send for Fs
impl Sync for Fs
impl Unpin for Fs
impl UnsafeUnpin for Fs
impl UnwindSafe for Fs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more