Struct WebTransportSession

Source
pub struct WebTransportSession<C, B>
where C: Connection<B>, B: Buf,
{ /* private fields */ }
Expand description

WebTransport session driver.

Maintains the session using the underlying HTTP/3 connection.

Similar to h3::server::Connection it is generic over the QUIC implementation and Buffer.

Implementations§

Source§

impl<C, B> WebTransportSession<C, B>
where C: Connection<B>, B: Buf,

Source

pub fn session_id(&self) -> SessionId

Returns the session id

Source

pub async fn accept_bi(&self) -> Option<BidiStream<C::BidiStream, B>>

Accepts a bidi stream

Source

pub fn poll_accept_bi( &self, cx: &mut Context<'_>, ) -> Poll<Option<BidiStream<C::BidiStream, B>>>

Polls for a bidi stream

Source

pub async fn accept_uni(&self) -> Option<RecvStream<C::RecvStream, B>>

Accepts a uni stream

Source

pub fn poll_accept_uni( &self, cx: &mut Context<'_>, ) -> Poll<Option<RecvStream<C::RecvStream, B>>>

Polls for a uni stream

Source

pub async fn accept_datagram(&self) -> Option<B>

Accepts a datagram

Source

pub fn poll_accept_datagram(&self, cx: &mut Context<'_>) -> Poll<Option<B>>

Polls for a datagram

Source

pub async fn send_datagram(&self, datagram: B) -> Result<(), Error>

Sends a datagram

Source

pub async fn open_bi( &self, ) -> Result<BidiStream<C::BidiStream, B>, <C::OpenStreams as OpenStreams<B>>::OpenError>

Opens a bidi stream

Source

pub fn poll_open_bi( &self, cx: &mut Context<'_>, ) -> Poll<Result<BidiStream<C::BidiStream, B>, <C::OpenStreams as OpenStreams<B>>::OpenError>>

Polls to open a bidi stream

Source

pub async fn open_uni( &self, ) -> Result<SendStream<C::SendStream, B>, <C::OpenStreams as OpenStreams<B>>::OpenError>

Opens a uni stream

Source

pub fn poll_open_uni( &self, cx: &mut Context<'_>, ) -> Poll<Result<SendStream<C::SendStream, B>, <C::OpenStreams as OpenStreams<B>>::OpenError>>

Polls to open a uni stream

Source§

impl<C, B> WebTransportSession<C, B>
where C: Connection<B>, B: Buf,

Source

pub fn begin<B2, F, Fut>( request: &mut Request<B2>, on_upgrade: F, ) -> Option<Response<()>>
where C: Connection<B> + 'static, B: Buf + 'static + Send + Sync, C::AcceptError: Send + Sync, C::BidiStream: Send + Sync, C::RecvStream: Send + Sync, C::OpenStreams: Send + Sync, Fut: Future<Output = ()> + Send + Sync + 'static, F: FnOnce(WebTransportSession<C, B>) -> Fut + Send + Sync + 'static,

Begin a WebTransport session upgrade

Source

pub fn complete( response: &mut Response<B>, stream: RequestStream<C::BidiStream, B>, ) -> Result<BoxFuture<'static, Result<(), Error>>, RequestStream<C::BidiStream, B>>
where C: Connection<B> + 'static, B: Buf + 'static + Send + Sync,

Completes the WebTransport upgrade

Source

pub async fn accept<E, E2>( request: &mut Request<()>, stream: RequestStream<C::BidiStream, B>, ) -> Result<Option<WebTransportSession<C, B>>, Error>
where C: Connection<B> + SendDatagramExt<B, Error = E> + RecvDatagramExt<Buf = B, Error = E2> + 'static, B: Buf + 'static + Send + Sync, C::AcceptError: Send + Sync, C::BidiStream: Send + Sync, C::RecvStream: Send + Sync, C::OpenStreams: Send + Sync, E: Into<Error>, E2: Into<Error>,

Accepts a WebTransport session from an incoming request

Trait Implementations§

Source§

impl<C, B> Drop for WebTransportSession<C, B>
where C: Connection<B>, B: Buf,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<C, B> !Freeze for WebTransportSession<C, B>

§

impl<C, B> RefUnwindSafe for WebTransportSession<C, B>
where <C as OpenStreams<B>>::BidiStream: RefUnwindSafe, B: RefUnwindSafe,

§

impl<C, B> Send for WebTransportSession<C, B>
where <C as Connection<B>>::OpenStreams: Send, <C as OpenStreams<B>>::BidiStream: Send, B: Send, <C as Connection<B>>::RecvStream: Send,

§

impl<C, B> Sync for WebTransportSession<C, B>
where <C as Connection<B>>::OpenStreams: Send, <C as OpenStreams<B>>::BidiStream: Sync + Send, B: Sync + Send, <C as Connection<B>>::RecvStream: Send,

§

impl<C, B> Unpin for WebTransportSession<C, B>
where <C as Connection<B>>::OpenStreams: Unpin,

§

impl<C, B> UnwindSafe for WebTransportSession<C, B>
where <C as OpenStreams<B>>::BidiStream: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more