pub struct Resolver {
pub config: Config,
/* private fields */
}Fields§
§config: ConfigImplementations§
Source§impl Resolver
impl Resolver
pub fn new(config: Config) -> Self
Sourcepub fn preload(&self, lib: &str, ext: &str, bytes: Vec<u8>)
pub fn preload(&self, lib: &str, ext: &str, bytes: Vec<u8>)
Supply {lib}.{ext} bytes ahead of resolution. Preloaded
sources win over every base layer, so a host can satisfy
dependency lookups from memory alone.
Sourcepub fn take_missing(&self) -> Vec<(String, String)>
pub fn take_missing(&self) -> Vec<(String, String)>
Drain the (lib, ext) pairs whose resolution has failed so
far. A host fetches these, preloads them, and retries.
Sourcepub fn contains(
&self,
lib: &str,
name: &str,
layer1: &[(String, String)],
) -> Result<bool, PipelineError>
pub fn contains( &self, lib: &str, name: &str, layer1: &[(String, String)], ) -> Result<bool, PipelineError>
Does lib define name?
Sourcepub fn def(
&self,
lib: &str,
name: &str,
layer1: &[(String, String)],
) -> Result<TypeDef, PipelineError>
pub fn def( &self, lib: &str, name: &str, layer1: &[(String, String)], ) -> Result<TypeDef, PipelineError>
The (unlowered) definition of lib’s type name — constraint
items plus the type’s default.
Sourcepub fn unit_names(
&self,
lib: &str,
layer1: &[(String, String)],
) -> Result<BTreeSet<String>, PipelineError>
pub fn unit_names( &self, lib: &str, layer1: &[(String, String)], ) -> Result<BTreeSet<String>, PipelineError>
The unit names (definitions and aliases) of a .faiv library
(SPEC.md § Unit Definition Files), for .!units imports.
Sourcepub fn unit_defs(
&self,
lib: &str,
layer1: &[(String, String)],
) -> Result<BTreeMap<String, UnitDef>, PipelineError>
pub fn unit_defs( &self, lib: &str, layer1: &[(String, String)], ) -> Result<BTreeMap<String, UnitDef>, PipelineError>
The unit definitions of a .faiv library, for consumers
that need the conversion factors themselves (e.g. a query
engine scaling custom units to base via
crate::unit::scale_with). Same load path and cache as
Self::unit_names.
Sourcepub fn schema_bytes(
&self,
lib: &str,
layer1: &[(String, String)],
) -> Result<Vec<u8>, PipelineError>
pub fn schema_bytes( &self, lib: &str, layer1: &[(String, String)], ) -> Result<Vec<u8>, PipelineError>
Locate and read {base}/{lib}.{ext} via Layer 1 (.!registry)
then Layer 2 (kaiv.kaiv); filesystem bases only.
Read a schema source (.saiv) for .!schema inheritance
resolution (SPEC.md § Encapsulated Hub Schema Extension).
Sourcepub fn csaiv_bytes(
&self,
lib: &str,
layer1: &[(String, String)],
) -> Result<Vec<u8>, PipelineError>
pub fn csaiv_bytes( &self, lib: &str, layer1: &[(String, String)], ) -> Result<Vec<u8>, PipelineError>
Read a compiled schema (.csaiv) for .!schema validation
of a canonical document.