pub trait CompanionStrategy: Send + Sync {
// Required methods
fn discovery(&self) -> CompanionDiscovery;
fn output_name(&self, source_dir: &[&str], stem: &str) -> String;
fn companion_media_types(&self) -> &'static [&'static str];
// Provided methods
fn companion_title(&self, stem: &str, bytes: &[u8]) -> String { ... }
fn discover_local(&self, contract_root: &Path) -> Result<Vec<CompanionFile>> { ... }
}Expand description
How a family discovers, names, and places companion docs (sync, local).
Associated with ContractFamily via
ContractFamily::CompanionStrategy.
Required Methods§
Sourcefn discovery(&self) -> CompanionDiscovery
fn discovery(&self) -> CompanionDiscovery
Returns the filesystem search strategy for companion files.
Sourcefn output_name(&self, source_dir: &[&str], stem: &str) -> String
fn output_name(&self, source_dir: &[&str], stem: &str) -> String
Computes the output filename for a companion given its source directory path segments and stem.
Sourcefn companion_media_types(&self) -> &'static [&'static str]
fn companion_media_types(&self) -> &'static [&'static str]
MIME types accepted for companion documents in this family.
Provided Methods§
Sourcefn companion_title(&self, stem: &str, bytes: &[u8]) -> String
fn companion_title(&self, stem: &str, bytes: &[u8]) -> String
Human nav title for a companion (default: first markdown # heading).
Sourcefn discover_local(&self, contract_root: &Path) -> Result<Vec<CompanionFile>>
fn discover_local(&self, contract_root: &Path) -> Result<Vec<CompanionFile>>
Discovers companions on the local filesystem relative to contract inputs.
Default returns empty; families with companion docs override.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".