ExtensionClient

Trait ExtensionClient 

Source
pub trait ExtensionClient<E: Extension>: PollClient {
    // Required method
    fn id() -> u8;

    // Provided method
    fn extension<Rq, Rp>(
        &mut self,
        request: Rq,
    ) -> ExtensionResult<'_, E, Rp, Self>
       where Rq: Into<E::Request>,
             Rp: TryFrom<E::Reply, Error = Error> { ... }
}
Available on crate feature serde-extensions only.
Expand description

Executes extension requests.

Instead of using this trait directly, extensions should define their own traits that extend this trait and use the extension function to execute extension requests.

Required Methods§

Source

fn id() -> u8

Returns the ID for the E extension as defined by the runner.

Provided Methods§

Source

fn extension<Rq, Rp>(&mut self, request: Rq) -> ExtensionResult<'_, E, Rp, Self>
where Rq: Into<E::Request>, Rp: TryFrom<E::Reply, Error = Error>,

Executes an extension request.

Applications should not call this method directly and instead use a trait provided by the extension.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§