polywrap_resolvers 0.1.6-beta.13

Uri resolvers to achieve uri resolution in Polywrap Client
Documentation
use polywrap_core::uri::Uri;
use polywrap_core::wrapper::Wrapper;
use std::sync::Arc;

/// A cache for storing `Wrapper` instances.
pub trait WrapperCache: Send + Sync {
    /// Gets the `Wrapper` instance for the given `Uri`.
    ///
    /// # Arguments
    ///
    /// * `uri` - The `Uri` to get the `Wrapper` for.
    ///
    /// # Returns
    ///
    /// * The `Wrapper` instance for the given `Uri`, or None if it does not exist.
    fn get(&self, uri: &Uri) -> Option<&Arc<dyn Wrapper>>;

    /// Sets the `Wrapper` instance for the given `Uri`.
    ///
    /// # Arguments
    ///
    /// * `uri` - The `Uri` to set the `Wrapper` for.
    /// * `wrapper` - The `Wrapper` instance to set.
    fn set(&mut self, uri: Uri, wrapper: Arc<dyn Wrapper>);
}