Skip to main content

Vfs

Trait Vfs 

Source
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§

Source

type Source: Source + 'static

The type of source returned by this VFS.

Required Methods§

Source

fn get_source(&self, uri: &str) -> Option<Self::Source>

Get the source for the given URI.

Source

fn get_uri(&self, id: u32) -> Option<Arc<str>>

Get the URI for the given SourceId.

Source

fn get_id(&self, uri: &str) -> Option<u32>

Get the SourceId for the given URI.

Source

fn exists(&self, uri: &str) -> bool

Check if a path exists at the given URI.

Source

fn metadata(&self, uri: &str) -> Option<FileMetadata>

Read the metadata for the given URI.

Source

fn read_dir(&self, uri: &str) -> Option<Vec<Arc<str>>>

Read the contents of a directory at the given URI. Returns a list of URIs or names.

Provided Methods§

Source

fn is_file(&self, uri: &str) -> bool

Check if the given URI points to a file.

Source

fn is_dir(&self, uri: &str) -> bool

Check if the given URI points to a directory.

Source

fn line_map(&self, uri: &str) -> Option<LineMap>

Implementors§