pub trait FileSystem: Send + Sync {
// Required methods
fn new(yarn_pnp: bool) -> Self;
fn read_to_string(&self, path: &Path) -> Result<String>;
fn metadata(&self, path: &Path) -> Result<FileMetadata>;
fn symlink_metadata(&self, path: &Path) -> Result<FileMetadata>;
fn read_link(&self, path: &Path) -> Result<PathBuf, ResolveError>;
// Provided method
fn read_to_string_bypass_system_cache(&self, path: &Path) -> Result<String> { ... }
}Expand description
File System abstraction used for ResolverGeneric
Required Methods§
fn new(yarn_pnp: bool) -> Self
Sourcefn read_to_string(&self, path: &Path) -> Result<String>
fn read_to_string(&self, path: &Path) -> Result<String>
Sourcefn metadata(&self, path: &Path) -> Result<FileMetadata>
fn metadata(&self, path: &Path) -> Result<FileMetadata>
Sourcefn symlink_metadata(&self, path: &Path) -> Result<FileMetadata>
fn symlink_metadata(&self, path: &Path) -> Result<FileMetadata>
Sourcefn read_link(&self, path: &Path) -> Result<PathBuf, ResolveError>
fn read_link(&self, path: &Path) -> Result<PathBuf, ResolveError>
Returns the resolution of a symbolic link.
§Errors
- Returns an error of
ResolveError::IOErrorkind if there is an IO error invokingstd::fs::read_link. - Returns an error of
ResolveError::PathNotSupportedkind if the symlink target cannot be represented as a path that can be consumed by theimport/requiresyntax of Node.js. Caller should not try to follow the symlink in this case.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.