pub trait PacketHandler {
    type Error;

    // Required method
    fn proc(&mut self, pkt: Packet<'_>) -> Result<(), Self::Error>;

    // Provided methods
    fn init(&mut self) -> Result<(), Self::Error> { ... }
    fn idle(&mut self) -> Result<(), Self::Error> { ... }
    fn inspect(&self, info: &RecvInfo) { ... }
    fn shutdown(&mut self) { ... }
}
Expand description

Application-defined packet handler callback.

Required Associated Types§

Required Methods§

source

fn proc(&mut self, pkt: Packet<'_>) -> Result<(), Self::Error>

Called to process packets.

Provided Methods§

source

fn init(&mut self) -> Result<(), Self::Error>

Called on the receiver thread before the processing reading and processing loop has been entered.

source

fn idle(&mut self) -> Result<(), Self::Error>

Available on crate feature idle only.

Called whenever a timeout has been reached without any new packets arriving.

source

fn inspect(&self, info: &RecvInfo)

Available on crate feature inspect only.

Called when the controller has requested an inspection.

source

fn shutdown(&mut self)

Called on the receiver thread once the main loop been been terminated.

Implementors§