PacketHandler

Trait PacketHandler 

Source
pub trait PacketHandler<Endpoint>: Clone {
    // Required method
    fn handle<'a>(
        &'a self,
        packet: Packet,
        peer: Endpoint,
    ) -> Pin<Box<dyn Stream<Item = Packet> + Send + 'a>>;
}
Expand description

“Low-level” raw packet handler intended to support the full range of CoAP features. This is little more than a callback informing the user that a packet has arrived, allowing for an arbitrary number of arbitrary responses to be delivered back to this Endpoint.

Most customers should steer clear of this footgun. It can be used in such a way that breaks protocol norms and could confuse clients easily. Prefer crate::app::new instead.

Required Methods§

Source

fn handle<'a>( &'a self, packet: Packet, peer: Endpoint, ) -> Pin<Box<dyn Stream<Item = Packet> + Send + 'a>>

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§

Source§

impl<Endpoint: Debug + Clone + Ord + Eq + Hash + Send + 'static> PacketHandler<Endpoint> for AppHandler<Endpoint>