Trait NativeDatagramChannel
pub trait NativeDatagramChannel:
Send
+ Sync
+ 'static {
// Required methods
fn max_payload_size(&self) -> Option<usize>;
fn send(
&self,
payload: Bytes,
policy: NativeSendPolicy,
) -> Result<(), NativeSendError>;
fn poll_recv(
&self,
cx: &mut Context<'_>,
) -> Poll<Result<Option<Bytes>, NativeRecvError>>;
fn dropped(&self) -> u64;
// Provided method
fn release_recv(&self) { ... }
}http and std only.Expand description
Unreliable delivery of HTTP Datagrams associated with one request, such as HTTP/3 QUIC DATAGRAM frames (RFC 9297 §2.1).
A transport publishes its implementation as a NativeDatagrams extension on the
upgraded I/O. Receiving is demultiplexed by the transport; one association has at most
one consumer. Enqueueing a datagram never implies delivery.
Required Methods§
fn max_payload_size(&self) -> Option<usize>
fn max_payload_size(&self) -> Option<usize>
The largest payload that can currently be sent, or None while native datagrams are
not negotiated. A snapshot: send decides.
fn send(
&self,
payload: Bytes,
policy: NativeSendPolicy,
) -> Result<(), NativeSendError>
fn send( &self, payload: Bytes, policy: NativeSendPolicy, ) -> Result<(), NativeSendError>
Hand a datagram to the transport without waiting.
Eligibility follows the transport’s send state of the request stream, whoever holds
the channel: once it is closed this returns NativeSendError::Closed.
Provided Methods§
fn release_recv(&self)
fn release_recv(&self)
The consumer is gone: discard queued datagrams and drop (count) later ones. The request stream itself is unaffected.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".