Struct salvo_core::proto::WebTransportSession
source · pub struct WebTransportSession<C, B>{ /* private fields */ }
Available on crate feature
quinn
only.Expand description
A WebTransport session.
Implementations§
source§impl<C, B> WebTransportSession<C, B>
impl<C, B> WebTransportSession<C, B>
sourcepub fn split(
self
) -> (Mutex<Connection<C, B>>, RequestStream<<C as Connection<B>>::BidiStream, B>)
pub fn split( self ) -> (Mutex<Connection<C, B>>, RequestStream<<C as Connection<B>>::BidiStream, B>)
Split the session into the underlying connection and stream.
sourcepub async fn accept(
stream: RequestStream<<C as Connection<B>>::BidiStream, B>,
conn: Connection<C, B>
) -> Result<WebTransportSession<C, B>, Error>
pub async fn accept( stream: RequestStream<<C as Connection<B>>::BidiStream, B>, conn: Connection<C, B> ) -> Result<WebTransportSession<C, B>, Error>
Accepts a CONNECT request for establishing a WebTransport session.
TODO: is the API or the user responsible for validating the CONNECT request?
sourcepub fn accept_datagram(&self) -> ReadDatagram<'_, C, B> ⓘ
pub fn accept_datagram(&self) -> ReadDatagram<'_, C, B> ⓘ
Receive a datagram from the client
sourcepub fn send_datagram(&self, data: B) -> Result<(), Error>where
C: SendDatagramExt<B>,
pub fn send_datagram(&self, data: B) -> Result<(), Error>where
C: SendDatagramExt<B>,
Sends a datagram
TODO: maybe make async. quinn
does not require an async send
sourcepub fn accept_uni(&self) -> AcceptUni<'_, C, B> ⓘ
pub fn accept_uni(&self) -> AcceptUni<'_, C, B> ⓘ
Accept an incoming unidirectional stream from the client, it reads the stream until EOF.
sourcepub async fn accept_bi(&self) -> Result<Option<AcceptedBi<C, B>>, Error>
pub async fn accept_bi(&self) -> Result<Option<AcceptedBi<C, B>>, Error>
Accepts an incoming bidirectional stream or request
sourcepub fn open_bi(&self, session_id: SessionId) -> OpenBi<'_, C, B> ⓘ
pub fn open_bi(&self, session_id: SessionId) -> OpenBi<'_, C, B> ⓘ
Open a new bidirectional stream
sourcepub fn open_uni(&self, session_id: SessionId) -> OpenUni<'_, C, B> ⓘ
pub fn open_uni(&self, session_id: SessionId) -> OpenUni<'_, C, B> ⓘ
Open a new unidirectional stream
sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the session id
Auto Trait Implementations§
impl<C, B> !Freeze for WebTransportSession<C, B>
impl<C, B> !RefUnwindSafe for WebTransportSession<C, B>
impl<C, B> Send for WebTransportSession<C, B>where
<C as Connection<B>>::OpenStreams: Send,
<C as Connection<B>>::SendStream: Send,
<C as Connection<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 Connection<B>>::SendStream: Send,
<C as Connection<B>>::BidiStream: Sync,
B: Sync + Send,
<C as Connection<B>>::RecvStream: Send,
impl<C, B> Unpin for WebTransportSession<C, B>
impl<C, B> !UnwindSafe for WebTransportSession<C, B>
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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