Skip to main content

Session

Struct Session 

Source
pub struct Session { /* private fields */ }
Expand description

A MoQ transport over the worker: raw QUIC, or a WebTransport session.

Request::respond builds the web flavor; Session::raw wraps a raw-QUIC Connection with the layering disabled. Clones share the session.

Implementations§

Source§

impl Session

Source

pub fn raw(conn: Connection) -> Self

Wrap a raw-QUIC connection in a session, with no WebTransport layering: streams and datagrams pass through untouched.

Trait Implementations§

Source§

impl Clone for Session

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Session

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Session for Session

Source§

type SendStream = SendStream

The outgoing stream type. Only the poll half is required, so a !Send session can hang !Send streams off it.
Source§

type RecvStream = RecvStream

The incoming stream type. Only the poll half is required, so a !Send session can hang !Send streams off it.
Source§

type Error = Error

The error type for every operation on this session.
Source§

fn poll_accept_uni( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::RecvStream, Self::Error>>

Poll for a unidirectional stream created by the peer.
Source§

fn poll_accept_bi( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(Self::SendStream, Self::RecvStream), Self::Error>>

Poll for a bidirectional stream created by the peer.
Source§

fn poll_open_uni( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::SendStream, Self::Error>>

Poll to open a unidirectional stream, which blocks while there are too many concurrent streams.
Source§

fn poll_open_bi( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(Self::SendStream, Self::RecvStream), Self::Error>>

Poll to open a bidirectional stream, which blocks while there are too many concurrent streams.
Source§

fn poll_send_datagram( &mut self, cx: &mut Context<'_>, payload: &[u8], ) -> Poll<Result<(), Self::Error>>

Poll to send a datagram over the network. Read more
Source§

fn poll_recv_datagram( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Bytes, Self::Error>>

Poll for a datagram from the network.
Source§

fn max_datagram_size(&self) -> usize

The maximum size of a datagram that can be sent.
Source§

fn protocol(&self) -> Option<&str>

Return the application protocol negotiated for this session, if any. Read more
Source§

fn close(&mut self, code: u32, reason: &str)

Close the connection immediately with a code and reason. Read more
Source§

fn poll_closed(&mut self, cx: &mut Context<'_>) -> Poll<Self::Error>

Poll until the connection is closed by either side.
Source§

fn stats(&self) -> impl Stats

Return connection-level statistics. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<S> Session for S
where S: Session + Clone + 'static, <S as Session>::SendStream: SendStream, <S as Session>::RecvStream: RecvStream,

Source§

fn accept_uni(&mut self) -> AcceptUni<'_, Self> ⓘ

Accept the next unidirectional stream opened by the peer.
Source§

fn accept_bi(&mut self) -> AcceptBi<'_, Self> ⓘ

Accept the next bidirectional stream opened by the peer.
Source§

fn open_uni(&mut self) -> OpenUni<'_, Self> ⓘ

Open a unidirectional stream, waiting for stream credit if necessary.
Source§

fn open_bi(&mut self) -> OpenBi<'_, Self> ⓘ

Open a bidirectional stream, waiting for stream credit if necessary.
Source§

fn recv_datagram(&mut self) -> RecvDatagram<'_, Self> ⓘ

Receive the next datagram from the peer.
Source§

fn send_datagram(&mut self, payload: &[u8]) -> Result<(), Self::Error>

Send a datagram, best-effort: if the transport has no room for it right now, the datagram is dropped, exactly as the network is allowed to do.
Source§

fn closed(&mut self) -> SessionClosed<'_, Self> ⓘ

Wait until the session is closed by either side, returning the reason.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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