Skip to main content

MsgReply

Trait MsgReply 

Source
pub(crate) trait MsgReply {
    // Required method
    fn reply(&mut self, msg: &[u8]) -> Option<Vec<u8>>;
}
Expand description

Trait for an object that handle and incoming client message and return a server’s reply.

This is implemented for FnMut(&[u8]) -> Option<Vec<u8>> automatically.

Required Methods§

Source

fn reply(&mut self, msg: &[u8]) -> Option<Vec<u8>>

Given a message received from a client, parse it and decide how (and whether) to reply.

Return None if the handshake should fail.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> MsgReply for F
where F: FnMut(&[u8]) -> Option<Vec<u8>>,