pub struct Session { /* private fields */ }Expand description
A session represents a client-to-server connection.
This is the main entry point for creating streams and sending datagrams. Either endpoint may close the session with an error code and reason.
The session can be cloned to create multiple handles. However, handles cannot currently accept or open the same stream type.
Implementations§
Source§impl Session
impl Session
pub fn new(inner: WebTransport, url: Url) -> Self
Sourcepub async fn accept_uni(&self) -> Result<RecvStream, Error>
pub async fn accept_uni(&self) -> Result<RecvStream, Error>
Accept a new unidirectional stream from the peer.
Sourcepub async fn accept_bi(&self) -> Result<(SendStream, RecvStream), Error>
pub async fn accept_bi(&self) -> Result<(SendStream, RecvStream), Error>
Accept a new bidirectional stream from the peer.
Sourcepub async fn open_bi(&self) -> Result<(SendStream, RecvStream), Error>
pub async fn open_bi(&self) -> Result<(SendStream, RecvStream), Error>
Create a new bidirectional stream.
Sourcepub async fn open_uni(&self) -> Result<SendStream, Error>
pub async fn open_uni(&self) -> Result<SendStream, Error>
Create a new unidirectional stream.
Sourcepub async fn send_datagram(&self, payload: Bytes) -> Result<(), Error>
pub async fn send_datagram(&self, payload: Bytes) -> Result<(), Error>
Send a datagram over the network.
Sourcepub async fn recv_datagram(&self) -> Result<Bytes, Error>
pub async fn recv_datagram(&self) -> Result<Bytes, Error>
Receive a datagram over the network.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more