Skip to main content

ModuleReader

Trait ModuleReader 

Source
pub trait ModuleReader: Send + Sync {
    // Required methods
    fn scheme(&self) -> &str;
    fn has_hierarchical_uris(&self) -> bool;
    fn is_local(&self) -> bool;
    fn is_globbable(&self) -> bool;
    fn read(&self, uri: &str) -> Result<String, String>;

    // Provided method
    fn list(&self, uri: &str) -> Result<Vec<PathElement>, String> { ... }
}
Expand description

A custom module reader that can resolve modules by URI scheme.

Required Methods§

Source

fn scheme(&self) -> &str

The URI scheme this reader handles (e.g., “myscheme”).

Source

fn has_hierarchical_uris(&self) -> bool

Whether URIs of this scheme are hierarchical.

Source

fn is_local(&self) -> bool

Whether this scheme refers to local resources.

Source

fn is_globbable(&self) -> bool

Whether this reader supports globbing.

Source

fn read(&self, uri: &str) -> Result<String, String>

Read the module source at the given URI.

Provided Methods§

Source

fn list(&self, uri: &str) -> Result<Vec<PathElement>, String>

List modules at the given URI (for globbing support).

Implementors§