pub struct WebTransportDispatcher(/* private fields */);Expand description
Dispatcher for inbound WebTransport streams on a QUIC connection.
Bridges the QUIC connection handler, which delivers streams as they arrive, with WebTransport
session handlers that register later via get_or_init_with.
Streams that arrive before a handler registers are buffered and delivered when the handler
registers.
Cheaply cloneable.
Implementations§
Source§impl WebTransportDispatcher
impl WebTransportDispatcher
Sourcepub fn dispatch(&self, stream: WebTransportStream)
pub fn dispatch(&self, stream: WebTransportStream)
Dispatch an inbound WebTransport stream to the registered handler, or buffer it.
Sourcepub fn get_or_init_with<T: WebTransportDispatch>(
&self,
init: impl FnOnce() -> T,
) -> Option<Arc<T>>
pub fn get_or_init_with<T: WebTransportDispatch>( &self, init: impl FnOnce() -> T, ) -> Option<Arc<T>>
Get or initialize the dispatch handler.
If no handler is registered yet, calls init to create one, transitions from
buffering to active, and drains any buffered streams through the new handler.
If a handler is already registered and its concrete type matches T, returns
a clone of the existing Arc<T>.
Returns None if a handler is already registered but is a different concrete type.
Trait Implementations§
Source§impl Clone for WebTransportDispatcher
impl Clone for WebTransportDispatcher
Source§fn clone(&self) -> WebTransportDispatcher
fn clone(&self) -> WebTransportDispatcher
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more