Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem {
    // Required methods
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_to_string<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn symlink_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn canonicalize<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

File System abstraction used for ResolverGeneric

Required Methods§

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn read_to_string<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

See std::fs::read_to_string

§Errors
§Warning

Use &Path instead of a generic P: AsRef<Path> here, because object safety requirements, it is especially useful, when you want to store multiple dyn FileSystem in a Vec or use a ResolverGeneric<Fs> in napi env.

Source

fn metadata<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

See std::fs::metadata

§Errors

See std::fs::metadata

§Warning

Use &Path instead of a generic P: AsRef<Path> here, because object safety requirements, it is especially useful, when you want to store multiple dyn FileSystem in a Vec or use a ResolverGeneric<Fs> in napi env.

See std::fs::symlink_metadata

§Errors

See std::fs::symlink_metadata

§Warning

Use &Path instead of a generic P: AsRef<Path> here, because object safety requirements, it is especially useful, when you want to store multiple dyn FileSystem in a Vec or use a ResolverGeneric<Fs> in napi env.

Source

fn canonicalize<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

See std::fs::canonicalize

§Errors

See std::fs::read_link

§Warning

Use &Path instead of a generic P: AsRef<Path> here, because object safety requirements, it is especially useful, when you want to store multiple dyn FileSystem in a Vec or use a ResolverGeneric<Fs> in napi env.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§