Skip to main content

PackContext

Trait PackContext 

Source
pub trait PackContext {
    // Required methods
    fn list_files(&self, scope: &PackScope) -> Vec<Utf8PathBuf>;
    fn read(&self, file: &Utf8Path) -> Result<String>;
    fn modified(&self, file: &Utf8Path) -> Option<SystemTime>;
    fn in_edges(&self, file: &Utf8Path) -> Result<usize>;
}
Expand description

Abstracts filesystem access and metadata needed by the packer.

All path arguments use Utf8Path from the camino crate. Implementors do not need to perform std::path conversions — the packer only operates on UTF-8 paths.

Required Methods§

Source

fn list_files(&self, scope: &PackScope) -> Vec<Utf8PathBuf>

Return every file path that matches the given scope.

Source

fn read(&self, file: &Utf8Path) -> Result<String>

Read the full contents of file as a string.

Source

fn modified(&self, file: &Utf8Path) -> Option<SystemTime>

Return the last-modified timestamp of file, if available.

Source

fn in_edges(&self, file: &Utf8Path) -> Result<usize>

Return the count of inbound edges (callers, importers) for file in the symbol graph. Returns 0 if no graph data is available.

Implementors§