pub struct Stream<K, S> { /* private fields */ }Expand description
A QUIC/HTTP3/WebTransport stream.
Implementations§
Source§impl Stream<BiRemote, Quic>
impl Stream<BiRemote, Quic>
Sourcepub fn upgrade(self) -> StreamBiRemoteH3
pub fn upgrade(self) -> StreamBiRemoteH3
Upgrades to an HTTP3 stream.
Source§impl Stream<BiRemote, H3>
impl Stream<BiRemote, H3>
Sourcepub fn read_frame<'a, R>(
&mut self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
pub fn read_frame<'a, R>(
&mut self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
See Frame::read.
Sourcepub async fn read_frame_async<'a, R>(
&mut self,
reader: &mut R,
) -> Result<Frame<'a>, IoReadError>
pub async fn read_frame_async<'a, R>( &mut self, reader: &mut R, ) -> Result<Frame<'a>, IoReadError>
See Frame::read_async.
Sourcepub fn read_frame_from_buffer<'a>(
&mut self,
buffer_reader: &mut BufferReader<'a>,
) -> Result<Option<Frame<'a>>, ErrorCode>
pub fn read_frame_from_buffer<'a>( &mut self, buffer_reader: &mut BufferReader<'a>, ) -> Result<Option<Frame<'a>>, ErrorCode>
Sourcepub fn write_frame<W>(
&self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
pub fn write_frame<W>(
&self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
See Frame::write.
Sourcepub async fn write_frame_async<W>(
&self,
frame: Frame<'_>,
writer: &mut W,
) -> Result<(), IoWriteError>
pub async fn write_frame_async<W>( &self, frame: Frame<'_>, writer: &mut W, ) -> Result<(), IoWriteError>
See Frame::write_async.
Sourcepub fn write_frame_to_buffer(
&self,
frame: Frame<'_>,
buffer_writer: &mut BufferWriter<'_>,
) -> Result<(), EndOfBuffer>
pub fn write_frame_to_buffer( &self, frame: Frame<'_>, buffer_writer: &mut BufferWriter<'_>, ) -> Result<(), EndOfBuffer>
Sourcepub fn upgrade(self, session_id: SessionId) -> StreamBiRemoteWT
pub fn upgrade(self, session_id: SessionId) -> StreamBiRemoteWT
Upgrades to a WebTransport stream.
Note: upgrade should be performed only when FrameKind::WebTransport is
received as first frame on this HTTP3 stream.
Sourcepub fn into_session(self, session_request: SessionRequest) -> StreamSession
pub fn into_session(self, session_request: SessionRequest) -> StreamSession
Converts the stream into a StreamSession.
Source§impl Stream<BiRemote, WT>
impl Stream<BiRemote, WT>
Sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the SessionId associated with this stream.
Source§impl Stream<BiLocal, Quic>
impl Stream<BiLocal, Quic>
Sourcepub fn upgrade(self) -> StreamBiLocalH3
pub fn upgrade(self) -> StreamBiLocalH3
Upgrades to an HTTP3 stream.
Source§impl Stream<BiLocal, H3>
impl Stream<BiLocal, H3>
Sourcepub fn read_frame<'a, R>(
&self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
pub fn read_frame<'a, R>(
&self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
See Frame::read.
Sourcepub async fn read_frame_async<'a, R>(
&self,
reader: &mut R,
) -> Result<Frame<'a>, IoReadError>
pub async fn read_frame_async<'a, R>( &self, reader: &mut R, ) -> Result<Frame<'a>, IoReadError>
See Frame::read_async.
Sourcepub fn read_frame_from_buffer<'a>(
&self,
buffer_reader: &mut BufferReader<'a>,
) -> Result<Option<Frame<'a>>, ErrorCode>
pub fn read_frame_from_buffer<'a>( &self, buffer_reader: &mut BufferReader<'a>, ) -> Result<Option<Frame<'a>>, ErrorCode>
Sourcepub fn write_frame<W>(
&mut self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
pub fn write_frame<W>(
&mut self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
Sourcepub async fn write_frame_async<W>(
&mut self,
frame: Frame<'_>,
writer: &mut W,
) -> Result<(), IoWriteError>
pub async fn write_frame_async<W>( &mut self, frame: Frame<'_>, writer: &mut W, ) -> Result<(), IoWriteError>
Sourcepub fn write_frame_to_buffer(
&mut self,
frame: Frame<'_>,
buffer_writer: &mut BufferWriter<'_>,
) -> Result<(), EndOfBuffer>
pub fn write_frame_to_buffer( &mut self, frame: Frame<'_>, buffer_writer: &mut BufferWriter<'_>, ) -> Result<(), EndOfBuffer>
Sourcepub fn upgrade<W>(
self,
session_id: SessionId,
bytes_writer: &mut W,
) -> StreamBiLocalWTwhere
W: BytesWriter,
pub fn upgrade<W>(
self,
session_id: SessionId,
bytes_writer: &mut W,
) -> StreamBiLocalWTwhere
W: BytesWriter,
Upgrades to a WebTransport stream.
§Panics
- Panics if any other I/O operation has been performed on this stream before upgrade.
- Panics if
bytes_writerdoes not have enough capacity. SeeSelf::upgrade_size.
Sourcepub async fn upgrade_async<W>(
self,
session_id: SessionId,
writer: &mut W,
) -> Result<StreamBiLocalWT, IoWriteError>
pub async fn upgrade_async<W>( self, session_id: SessionId, writer: &mut W, ) -> Result<StreamBiLocalWT, IoWriteError>
Upgrades to a WebTransport stream.
§Panics
- Panics if any other I/O operation has been performed on this stream before upgrade.
Sourcepub fn upgrade_size(&self, session_id: SessionId) -> usize
pub fn upgrade_size(&self, session_id: SessionId) -> usize
Returns the needed capacity for upgrade via Self::upgrade.
Sourcepub fn into_session(self, session_request: SessionRequest) -> StreamSession
pub fn into_session(self, session_request: SessionRequest) -> StreamSession
Converts the stream into a StreamSession.
Source§impl Stream<BiLocal, WT>
impl Stream<BiLocal, WT>
Sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the SessionId associated with this stream.
Source§impl Stream<UniRemote, Quic>
impl Stream<UniRemote, Quic>
Sourcepub fn accept_uni() -> Self
pub fn accept_uni() -> Self
Creates a new remote-initialized unidirectional stream.
Sourcepub fn upgrade<'a, R>(
self,
bytes_reader: &mut R,
) -> Result<MaybeUpgradeH3, ErrorCode>where
R: BytesReader<'a>,
pub fn upgrade<'a, R>(
self,
bytes_reader: &mut R,
) -> Result<MaybeUpgradeH3, ErrorCode>where
R: BytesReader<'a>,
Upgrades to an HTTP3 stream.
Because bytes_reader could not contain all required data, this behaves more like
an attempt of upgrading.
In case there are no enough information, MaybeUpgradeH3::Quic (i.e, self)
will be returned.
If the stream type is unknown ErrorCode::StreamCreation is returned.
In that case, MUST NOT consider unknown stream types to be a connection error of any kind.
Sourcepub async fn upgrade_async<R>(
self,
reader: &mut R,
) -> Result<StreamUniRemoteH3, IoReadError>
pub async fn upgrade_async<R>( self, reader: &mut R, ) -> Result<StreamUniRemoteH3, IoReadError>
Upgrades to an HTTP3 stream.
Source§impl Stream<UniRemote, H3>
impl Stream<UniRemote, H3>
Sourcepub fn read_frame<'a, R>(
&mut self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
pub fn read_frame<'a, R>(
&mut self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
See Frame::read.
§Panics
Panics if the stream kind is StreamKind::WebTransport. In that case, use upgrade method.
Sourcepub async fn read_frame_async<'a, R>(
&mut self,
reader: &mut R,
) -> Result<Frame<'a>, IoReadError>
pub async fn read_frame_async<'a, R>( &mut self, reader: &mut R, ) -> Result<Frame<'a>, IoReadError>
See Frame::read_async.
§Panics
Panics if the stream kind is StreamKind::WebTransport. In that case, use upgrade method.
Sourcepub fn read_frame_from_buffer<'a>(
&mut self,
buffer_reader: &mut BufferReader<'a>,
) -> Result<Option<Frame<'a>>, ErrorCode>
pub fn read_frame_from_buffer<'a>( &mut self, buffer_reader: &mut BufferReader<'a>, ) -> Result<Option<Frame<'a>>, ErrorCode>
§Panics
Panics if the stream kind is StreamKind::WebTransport. In that case, use upgrade method.
Sourcepub fn upgrade(self) -> StreamUniRemoteWT
pub fn upgrade(self) -> StreamUniRemoteWT
Upgrades to a WebTransport stream.
§Panics
Panics if the stream kind is not StreamKind::WebTransport.
Sourcepub fn kind(&self) -> StreamKind
pub fn kind(&self) -> StreamKind
Returns the StreamKind associated with the stream.
Sourcepub fn session_id(&self) -> Option<SessionId>
pub fn session_id(&self) -> Option<SessionId>
Returns the SessionId if stream is StreamKind::WebTransport,
otherwise returns None.
Source§impl Stream<UniRemote, WT>
impl Stream<UniRemote, WT>
Sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the SessionId associated with this stream.
Source§impl Stream<UniLocal, Quic>
impl Stream<UniLocal, Quic>
Sourcepub fn upgrade<W>(
self,
stream_header: StreamHeader,
bytes_writer: &mut W,
) -> StreamUniLocalH3where
W: BytesWriter,
pub fn upgrade<W>(
self,
stream_header: StreamHeader,
bytes_writer: &mut W,
) -> StreamUniLocalH3where
W: BytesWriter,
Upgrades to an HTTP3 stream.
§Panics
Panics if bytes_writer does not have enough capacity to write
the stream_header.
Check it with Self::upgrade_size.
Sourcepub async fn upgrade_async<W>(
self,
stream_header: StreamHeader,
writer: &mut W,
) -> Result<StreamUniLocalH3, IoWriteError>
pub async fn upgrade_async<W>( self, stream_header: StreamHeader, writer: &mut W, ) -> Result<StreamUniLocalH3, IoWriteError>
Upgrades to an HTTP3 stream.
Sourcepub fn upgrade_size(stream_header: StreamHeader) -> usize
pub fn upgrade_size(stream_header: StreamHeader) -> usize
Returns the buffer capacity needed for Self::upgrade.
Source§impl Stream<UniLocal, H3>
impl Stream<UniLocal, H3>
Sourcepub fn write_frame<W>(
&mut self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
pub fn write_frame<W>(
&mut self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
See Frame::write.
§Panics
Panics if the stream kind is StreamKind::WebTransport. In that case, use upgrade method.
Sourcepub async fn write_frame_async<W>(
&mut self,
frame: Frame<'_>,
writer: &mut W,
) -> Result<(), IoWriteError>
pub async fn write_frame_async<W>( &mut self, frame: Frame<'_>, writer: &mut W, ) -> Result<(), IoWriteError>
See Frame::write_async.
§Panics
Panics if the stream kind is StreamKind::WebTransport. In that case, use upgrade method.
Sourcepub fn write_frame_to_buffer(
&mut self,
frame: Frame<'_>,
buffer_writer: &mut BufferWriter<'_>,
) -> Result<(), EndOfBuffer>
pub fn write_frame_to_buffer( &mut self, frame: Frame<'_>, buffer_writer: &mut BufferWriter<'_>, ) -> Result<(), EndOfBuffer>
§Panics
Panics if the stream kind is StreamKind::WebTransport. In that case, use upgrade method.
Sourcepub fn upgrade(self) -> StreamUniLocalWT
pub fn upgrade(self) -> StreamUniLocalWT
Upgrades to a WebTransport stream.
§Panics
Panics if the stream kind is not StreamKind::WebTransport.
Sourcepub fn kind(&self) -> StreamKind
pub fn kind(&self) -> StreamKind
Returns the StreamKind associated with the stream.
Sourcepub fn session_id(&self) -> Option<SessionId>
pub fn session_id(&self) -> Option<SessionId>
Returns the SessionId if stream is StreamKind::WebTransport,
otherwise returns None.
Source§impl Stream<UniLocal, WT>
impl Stream<UniLocal, WT>
Sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the SessionId associated with this stream.
Source§impl Stream<Bi, Session>
impl Stream<Bi, Session>
Sourcepub fn read_frame<'a, R>(
&self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
pub fn read_frame<'a, R>(
&self,
bytes_reader: &mut R,
) -> Result<Option<Frame<'a>>, ErrorCode>where
R: BytesReader<'a>,
See Frame::read.
Sourcepub async fn read_frame_async<'a, R>(
&self,
reader: &mut R,
) -> Result<Frame<'a>, IoReadError>
pub async fn read_frame_async<'a, R>( &self, reader: &mut R, ) -> Result<Frame<'a>, IoReadError>
See Frame::read_async.
Sourcepub fn read_frame_from_buffer<'a>(
&self,
buffer_reader: &mut BufferReader<'a>,
) -> Result<Option<Frame<'a>>, ErrorCode>
pub fn read_frame_from_buffer<'a>( &self, buffer_reader: &mut BufferReader<'a>, ) -> Result<Option<Frame<'a>>, ErrorCode>
Sourcepub fn write_frame<W>(
&self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
pub fn write_frame<W>(
&self,
frame: Frame<'_>,
bytes_writer: &mut W,
) -> Result<(), EndOfBuffer>where
W: BytesWriter,
See Frame::write.
Sourcepub async fn write_frame_async<W>(
&self,
frame: Frame<'_>,
writer: &mut W,
) -> Result<(), IoWriteError>
pub async fn write_frame_async<W>( &self, frame: Frame<'_>, writer: &mut W, ) -> Result<(), IoWriteError>
See Frame::write_async.
Sourcepub fn write_frame_to_buffer(
&self,
frame: Frame<'_>,
buffer_writer: &mut BufferWriter<'_>,
) -> Result<(), EndOfBuffer>
pub fn write_frame_to_buffer( &self, frame: Frame<'_>, buffer_writer: &mut BufferWriter<'_>, ) -> Result<(), EndOfBuffer>
Sourcepub fn request(&self) -> &SessionRequest
pub fn request(&self) -> &SessionRequest
Returns the SessionRequest associated.