pub trait Fs: Send + Sync {
// Required methods
fn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<Vec<FsDirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn is_file<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn is_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn glob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
base: &'life1 Url,
pattern: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FsDirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Abstract filesystem trait. Implement this to provide a custom backend (e.g., in-memory for WASM, or virtual for testing).
Required Methods§
Sourcefn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read the entire contents of a file as a UTF-8 string.
Sourcefn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<Vec<FsDirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<Vec<FsDirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List the immediate children of a directory.
Sourcefn is_file<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_file<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether url is a file.
Sourcefn is_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check whether url is a directory.
Sourcefn glob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
base: &'life1 Url,
pattern: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FsDirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn glob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
base: &'life1 Url,
pattern: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FsDirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Return all entries whose paths match pattern relative to base.
pattern uses the same glob syntax as the platform-native glob (e.g.
node_modules/*/package.json, node_modules/@*/*/package.json).
Implementations should delegate to a native glob facility rather than
hand-rolling their own matching.