Skip to main content

SourceLoader

Trait SourceLoader 

Source
pub trait SourceLoader: Sync {
    // Required methods
    fn verify(&self) -> Result<(), String>;
    fn probe(&self, path: &str) -> Option<u64>;
    fn load(&self, path: &str) -> Option<String>;
}
Expand description

Source access supplied by the host that owns the repository or file store.

The index-build driver performs all source access through this trait and never reads the filesystem directly.

Required Methods§

Source

fn verify(&self) -> Result<(), String>

Verifies that the source root is available for a build.

Source

fn probe(&self, path: &str) -> Option<u64>

Returns the byte length of a regular file, or None when it cannot be probed or is not a regular file.

Source

fn load(&self, path: &str) -> Option<String>

Loads UTF-8 source text, or returns None when reading fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§