TokenResolver

Trait TokenResolver 

Source
pub trait TokenResolver: Send + Sync {
    // Required methods
    fn can_resolve(&self, token: &str) -> bool;
    fn resolve_token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
        context: &'life2 ResolutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<String, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_metadata(&self) -> PluginMetadata;

    // Provided method
    fn validate(&self) -> Result<(), PluginError> { ... }
}
Expand description

Async token resolver trait for plugins

Required Methods§

Source

fn can_resolve(&self, token: &str) -> bool

Check if this resolver can handle a given token

Source

fn resolve_token<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, context: &'life2 ResolutionContext, ) -> Pin<Box<dyn Future<Output = Result<String, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve a token to its value asynchronously

Source

fn get_metadata(&self) -> PluginMetadata

Get plugin metadata

Provided Methods§

Source

fn validate(&self) -> Result<(), PluginError>

Validate plugin configuration

Implementors§