Skip to main content

protocol

Attribute Macro protocol 

Source
#[protocol]
Available on crate feature macros only.
Expand description

Attach a protocol name to a handler type. Generates an associated PROTOCOL_NAME constant the ProtocolHandler::name impl can return.

#[protocol("rtmp")]
struct RtmpHandler { addr: std::net::SocketAddr }

#[async_trait]
impl ProtocolHandler for RtmpHandler {
    fn name(&self) -> &'static str { Self::PROTOCOL_NAME }
    // ...
}