pub trait Endpoint: 'static {
// Required method
fn on_datagram(&mut self, cx: &mut UdpCtx<'_>, data: &[u8], meta: &RecvMeta);
// Provided methods
fn on_timer(&mut self, cx: &mut UdpCtx<'_>, token: u64) { ... }
fn on_message(&mut self, cx: &mut UdpCtx<'_>, msg: Message) { ... }
fn on_stop(&mut self, cx: &mut UdpCtx<'_>) { ... }
fn is_busy(&self) -> bool { ... }
fn on_abort(&mut self, cx: &mut UdpCtx<'_>) { ... }
}Expand description
A UDP endpoint (for QUIC, a whole connection table) on one loop.
Required Methods§
Sourcefn on_datagram(&mut self, cx: &mut UdpCtx<'_>, data: &[u8], meta: &RecvMeta)
fn on_datagram(&mut self, cx: &mut UdpCtx<'_>, data: &[u8], meta: &RecvMeta)
A datagram arrived. With GRO on, data may hold several datagrams of
meta.segment_size bytes each. The buffer is reused once this returns.
Provided Methods§
Sourcefn on_timer(&mut self, cx: &mut UdpCtx<'_>, token: u64)
fn on_timer(&mut self, cx: &mut UdpCtx<'_>, token: u64)
A timer set with UdpCtx::set_timer expired.
Sourcefn on_message(&mut self, cx: &mut UdpCtx<'_>, msg: Message)
fn on_message(&mut self, cx: &mut UdpCtx<'_>, msg: Message)
A message from another thread arrived.
Sourcefn on_stop(&mut self, cx: &mut UdpCtx<'_>)
fn on_stop(&mut self, cx: &mut UdpCtx<'_>)
The runtime is stopping gracefully. Start winding down (QUIC: GOAWAY, then close each
connection once its streams finish). The loop keeps serving this endpoint, with its
datagrams, timers and messages, while Endpoint::is_busy says so and the grace
period lasts; then the socket is closed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".