Skip to main content

SourceProvider

Trait SourceProvider 

Source
pub trait SourceProvider: Send + Sync {
    // Required method
    fn read(&self, path: &str) -> Option<Arc<str>>;

    // Provided methods
    fn prefetch(&self, _paths: &[String]) { ... }
    fn clear_prefetch(&self) { ... }
}
Expand description

Read a file’s source text on demand. Returns None if the path is unreadable or doesn’t exist — the analyzer treats that as “this class is unresolvable” and (negative-)caches the failure.

Required Methods§

Source

fn read(&self, path: &str) -> Option<Arc<str>>

Provided Methods§

Source

fn prefetch(&self, _paths: &[String])

Hint that paths will be read soon, so they may be fetched concurrently.

Source

fn clear_prefetch(&self)

Drop hinted text that was never read.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§