Skip to main content

ChannelHandler

Trait ChannelHandler 

Source
pub trait ChannelHandler: Send {
    // Required methods
    fn start(&mut self, channel: &mut Channel);
    fn recv(&mut self, channel: &mut Channel, msg: Message);
}
Expand description

Trait for channel event handling (start/recv).

Implementors define the logic for initializing a channel and processing incoming messages.

Required Methods§

Source

fn start(&mut self, channel: &mut Channel)

Called when the channel is connected and ready.

Source

fn recv(&mut self, channel: &mut Channel, msg: Message)

Called when a complete message has been received.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§