pub trait Vfs: Send + Sync {
type Source: Source + 'static;
// Required methods
fn get_source(&self, uri: &str) -> Option<Self::Source>;
fn get_uri(&self, id: u32) -> Option<Arc<str>>;
fn get_id(&self, uri: &str) -> Option<u32>;
fn exists(&self, uri: &str) -> bool;
fn metadata(&self, uri: &str) -> Option<FileMetadata>;
fn read_dir(&self, uri: &str) -> Option<Vec<Arc<str>>>;
// Provided methods
fn is_file(&self, uri: &str) -> bool { ... }
fn is_dir(&self, uri: &str) -> bool { ... }
fn line_map(&self, uri: &str) -> Option<LineMap> { ... }
}Expand description
A trait for a Virtual File System that can provide source content and location mapping.
Required Associated Types§
Required Methods§
Sourcefn get_source(&self, uri: &str) -> Option<Self::Source>
fn get_source(&self, uri: &str) -> Option<Self::Source>
Get the source for the given URI.
Sourcefn metadata(&self, uri: &str) -> Option<FileMetadata>
fn metadata(&self, uri: &str) -> Option<FileMetadata>
Read the metadata for the given URI.