Skip to main content

Resolver

Trait Resolver 

Source
pub trait Resolver: Send + Sync {
    // Required method
    fn fetch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        uri: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Unfetchable>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn screens_local_paths(&self) -> bool { ... }
}
Expand description

Fetches descriptor-related content bytes.

check_content calls Resolver::fetch with effective references: descriptor URI references are resolved against base_uri when present and fragments are stripped before fetch.

Required Methods§

Source

fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, uri: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Unfetchable>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns bytes for uri, or an Unfetchable error when the resource cannot be fetched.

Provided Methods§

Source

fn screens_local_paths(&self) -> bool

Returns true when check_content should pre-screen local path references.

Resolvers that serve scheme-less local filesystem paths should opt into this. The screening rejects raw descriptor references and base_uri values containing queries, semicolon path parameters, backslashes, or .. path traversal before any fetch happens. Custom URI resolvers should keep the default false and enforce their own safety policy in fetch.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§