Protocol

Trait Protocol 

Source
pub trait Protocol {
    type Upgrade: ProtocolUpgradeSend + Clone;
    type RouterService: ProtocolRouter;

    // Required methods
    fn upgrade() -> Self::Upgrade;
    fn router(&self) -> Self::RouterService;
}
Expand description

The pubsub protocol trait.

This trait is used by the Behaviour to identify the pubsub protocol and create a connection handler instance for the protocol as well as the ProtocolRouter instance responsible for routing messages to the appropriate peers.

Required Associated Types§

Required Methods§

Source

fn upgrade() -> Self::Upgrade

Returns the protocol’s upgrade.

See ProtocolUpgrade for more information.

Source

fn router(&self) -> Self::RouterService

Returns the protocol’s router service.

See ProtocolRouter for more information.

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§