pub trait Handler:
Send
+ Sync
+ 'static {
// Required method
fn handle(
&self,
query: &[u8],
peer: SocketAddr,
protocol: Protocol,
response: &mut Vec<u8>,
) -> impl Future<Output = Action> + Send;
// Provided methods
fn udp_workers(&self) -> usize { ... }
fn parallel_query(
&self,
_query: &[u8],
_peer: SocketAddr,
) -> Option<Receiver<bool>> { ... }
fn handle_shared(
self: &Arc<Self>,
query: &[u8],
peer: SocketAddr,
protocol: Protocol,
response: &mut Vec<u8>,
) -> impl Future<Output = Action> + Send { ... }
}Expand description
Async, statically dispatched Query handling. Clear and reuse the supplied
Response buffer; return Drop to suppress a Response.
Handlers must not block the runtime; TCP Queries on a connection may run
concurrently.
Required Methods§
fn handle( &self, query: &[u8], peer: SocketAddr, protocol: Protocol, response: &mut Vec<u8>, ) -> impl Future<Output = Action> + Send
Provided Methods§
Sourcefn udp_workers(&self) -> usize
fn udp_workers(&self) -> usize
Number of UDP worker sockets for this Listener.
Sourcefn parallel_query(
&self,
_query: &[u8],
_peer: SocketAddr,
) -> Option<Receiver<bool>>
fn parallel_query( &self, _query: &[u8], _peer: SocketAddr, ) -> Option<Receiver<bool>>
Whether this HINFO Query must run concurrently with UDP reception.
Handle a Query while retaining access to the Listener’s owned state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".