Session

Struct Session 

Source
pub struct Session {
    pub datagrams: Datagrams,
    pub close_on_drop: bool,
    /* private fields */
}
Expand description

Session holds the web_wt_sys::WebTransport and is responsible for providing access to the Web API of WebTransport in a way that is portable. It also holds handles to the datagram reader and writer, as well as the datagram reader state.

Fields§

§datagrams: Datagrams

The datagrams state for this session.

§close_on_drop: bool

Whether to close the session on drop.

Implementations§

Source§

impl Session

Source

pub fn new(transport: WebTransport) -> Self

Construct a new session from a web_wt_sys::WebTransport.

Source

pub fn try_unwrap(self) -> Result<WebTransport, Self>

If possible, relieves the underlying web_wt_sys::WebTransport of any xwt-web-held locks and dependencies and exposes it.

Source

pub const fn transport_ref(&self) -> &Rc<WebTransport>

Obtain a transport ref.

Trait Implementations§

Source§

impl AcceptBi for Session

Source§

type Error = Error

Source§

async fn accept_bi( &self, ) -> Result<(Self::SendStream, Self::RecvStream), Self::Error>

Source§

impl AcceptUni for Session

Source§

type Error = Error

Source§

async fn accept_uni(&self) -> Result<Self::RecvStream, Self::Error>

Source§

impl Debug for Session

Source§

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

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

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl MaxSize for Session

Source§

fn max_datagram_size(&self) -> Option<usize>

Gets the maximum byte length that a user-sent datagram is allowed to be. Read more
Source§

impl OpenBi for Session

Source§

impl OpenUni for Session

Source§

impl Receive for Session

Source§

impl ReceiveInto for Session

Source§

type Error = Error

Source§

async fn receive_datagram_into( &self, buf: &mut [u8], ) -> Result<usize, Self::Error>

Source§

impl RecvSpec for Session

Source§

impl Send for Session

Source§

type Error = Error

Source§

async fn send_datagram<D>(&self, payload: D) -> Result<(), Self::Error>
where D: AsRef<[u8]>,

Source§

impl SendSpec for Session

Auto Trait Implementations§

§

impl !Freeze for Session

§

impl !RefUnwindSafe for Session

§

impl !Send for Session

§

impl !Sync for Session

§

impl Unpin for Session

§

impl UnwindSafe for Session

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.

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

impl<T> Connection for T
where T: Session,

Source§

impl<T> DatagramOps for T
where T: Send + MaxSize + Send + Receive + ReceiveInto,

Source§

impl<T> PairSpec for T
where T: Send + SendSpec + RecvSpec,

Source§

impl<T> Send for T

Source§

impl<T> Session for T

Source§

impl<T> StreamOps for T

Source§

impl<T> Sync for T