Skip to main content

SourceProvider

Trait SourceProvider 

Source
pub trait SourceProvider {
    // Required methods
    fn discover_features(&self) -> Result<Vec<String>, ProviderError>;
    fn discover_packs(&self) -> Result<Vec<String>, ProviderError>;
    fn discover_fragments(&self) -> Result<Vec<String>, ProviderError>;
    fn read(&self, name: &str) -> Result<Arc<str>, ProviderError>;
}
Expand description

Discovers and reads the feature files and macro packs of one suite.

Source names are filesystem paths rendered as strings — the identity used by Diag.source_name and PackSource.name throughout the pipeline. read returns raw bytes; normalization (BOM strip, trailing newline) is the parser’s job, so spans stay consistent with the CLI.

Required Methods§

Source

fn discover_features(&self) -> Result<Vec<String>, ProviderError>

Every feature source name under the suite, in the order the provider finds them.

Source

fn discover_packs(&self) -> Result<Vec<String>, ProviderError>

Every macro pack source name under the suite, in the order the provider finds them.

Source

fn discover_fragments(&self) -> Result<Vec<String>, ProviderError>

Every engine-native fragment file a pack may ref: (ADR-0018). Return an empty vec when the provider serves no fragments.

Deliberately not defaulted. Every implementation lives in this workspace, so a default body buys no compatibility — and it cost the feature once already: a delegating wrapper that forwarded the other two discoveries silently inherited “no fragments”, so the editor reported every ref: as unknown_ref while the same suite ran green. A required method makes a forwarding provider fail to compile instead.

Source

fn read(&self, name: &str) -> Result<Arc<str>, ProviderError>

The raw bytes of one source, keyed by a name returned from discovery.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§