Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required method
    fn id(&self) -> &'static str;

    // Provided methods
    fn init<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _prepared: &'life1 mut PreparedRequest,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
    fn hooks(&self) -> Hooks { ... }
}
Expand description

Plugin extension point for better-fetch.

Required Methods§

Source

fn id(&self) -> &'static str

Unique plugin identifier.

Provided Methods§

Source

fn init<'life0, 'life1, 'async_trait>( &'life0 self, _prepared: &'life1 mut PreparedRequest, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Called before lifecycle hooks; may mutate prepared.

Source

fn hooks(&self) -> Hooks

Hooks merged into the client hook chain at build time.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§