pub trait LayerResolver {
type Error;
// Required method
fn load(&mut self, key: &str) -> Result<Option<Vec<u8>>, Self::Error>;
// Provided method
fn key(
&mut self,
uri: &str,
importer: Option<&str>,
) -> Result<String, Self::Error> { ... }
}Expand description
Finds and loads layers for a LayerStackBuilder.
Resolution happens in two steps so that a layer imported from several
places loads once: key turns an import uri into a key that
identifies the layer, and load returns the bytes for a key
that is not loaded yet. Integrity is checked against exactly these bytes.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn key(
&mut self,
uri: &str,
importer: Option<&str>,
) -> Result<String, Self::Error>
fn key( &mut self, uri: &str, importer: Option<&str>, ) -> Result<String, Self::Error>
Identifies the layer that uri names. importer is the key of the
layer whose imports list uri, or None for the main layer, so
relative references can resolve against it.
The default uses uri unchanged, as upstream’s providers do.