Skip to main content

Resolve

Trait Resolve 

Source
pub trait Resolve:
    Debug
    + Send
    + Sync {
    // Required method
    fn resolve(&self, decoder: &DecoderRef<'_>) -> Option<Vec<u8>>;
}
Expand description

Something that can produce the module for a decoder that is not in the container.

A resolver is whatever the host has: a directory of modules it ships, a cache, a registry client, an operator who copied a file into place. This crate does not care which, and it does not care whether the resolver checked anything, because whatever comes back is hashed against the digest in the container before it goes anywhere.

Returning None is the ordinary answer for a decoder this host has no copy of. It is not an error and it is not a refusal, it is a resolver saying it does not have that one.

Required Methods§

Source

fn resolve(&self, decoder: &DecoderRef<'_>) -> Option<Vec<u8>>

Finds the module for a decoder, by whatever means this host has.

The whole reference is passed rather than just the digest, because a resolver that goes and fetches something needs the name to fetch it by. The digest is what the answer is checked against, so a resolver that ignores the name and returns the wrong module is caught rather than trusted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§