pub struct RecvStream<'a> { /* private fields */ }
Expand description
Access to streams
Implementations§
Source§impl RecvStream<'_>
impl RecvStream<'_>
Sourcepub fn read(&mut self, ordered: bool) -> Result<Chunks<'_>, ReadableError>
pub fn read(&mut self, ordered: bool) -> Result<Chunks<'_>, ReadableError>
Read from the given recv stream
max_length
limits the maximum size of the returned Bytes
value.
ordered
ensures the returned chunk’s offset is sequential.
Yields Ok(None)
if the stream was finished. Otherwise, yields a segment of data and its
offset in the stream.
Unordered reads can improve performance when packet loss occurs, but ordered reads
on streams that have seen previous unordered reads will return ReadError::IllegalOrderedRead
.
Sourcepub fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
pub fn stop(&mut self, error_code: VarInt) -> Result<(), ClosedStream>
Stop accepting data on the given receive stream
Discards unread data and notifies the peer to stop transmitting.
Sourcepub fn received_reset(&mut self) -> Result<Option<VarInt>, ClosedStream>
pub fn received_reset(&mut self) -> Result<Option<VarInt>, ClosedStream>
Check whether this stream has been reset by the peer
Returns the reset error code if the stream was reset.
Auto Trait Implementations§
impl<'a> Freeze for RecvStream<'a>
impl<'a> RefUnwindSafe for RecvStream<'a>
impl<'a> Send for RecvStream<'a>
impl<'a> Sync for RecvStream<'a>
impl<'a> Unpin for RecvStream<'a>
impl<'a> !UnwindSafe for RecvStream<'a>
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