Struct quinn::generic::RecvStream[][src]

pub struct RecvStream<S> where
    S: Session
{ /* fields omitted */ }

A stream that can only be used to receive data

stop(0) is implicitly called on drop unless:

Implementations

impl<S> RecvStream<S> where
    S: Session
[src]

pub fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, S>

Notable traits for Read<'a, S>

impl<'a, S> Future for Read<'a, S> where
    S: Session
type Output = Result<Option<usize>, ReadError>;
[src]

Read data contiguously from the stream.

Yields the number of bytes read into buf on success, or None if the stream was finished.

Applications involving bulk data transfer should consider using unordered reads for improved performance.

Panics

  • If used after read_unordered() on the same stream. This is forbidden because an unordered read could consume a segment of data from a location other than the start of the receive buffer, making it impossible for future

pub fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, S>

Notable traits for ReadExact<'a, S>

impl<'a, S> Future for ReadExact<'a, S> where
    S: Session
type Output = Result<(), ReadExactError>;
[src]

Read an exact number of bytes contiguously from the stream.

See read() for details.

pub fn read_chunk(
    &mut self,
    max_length: usize,
    ordered: bool
) -> ReadChunk<'_, S>

Notable traits for ReadChunk<'a, S>

impl<'a, S> Future for ReadChunk<'a, S> where
    S: Session
type Output = Result<Option<Chunk>, ReadError>;
[src]

Read the next segment of data

Yields None if the stream was finished. Otherwise, yields a segment of data and its offset in the stream. If ordered is true, the chunk’s offset will be immediately after the last data yielded by read() or read_chunk(). If ordered is false, segments may be received in any order, and the Chunk’s offset field can be used to determine ordering in the caller. Unordered reads have reduced overhead and higher throughput, and should therefore be preferred when applicable.

Slightly more efficient than read due to not copying. Chunk boundaries do not correspond to peer writes, and hence cannot be used as framing.

pub fn read_chunks<'a>(&'a mut self, bufs: &'a mut [Bytes]) -> ReadChunks<'a, S>

Notable traits for ReadChunks<'a, S>

impl<'a, S> Future for ReadChunks<'a, S> where
    S: Session
type Output = Result<Option<usize>, ReadError>;
[src]

Read the next segments of data

Fills bufs with the segments of data beginning immediately after the last data yielded by read or read_chunk, or None if the stream was finished.

Slightly more efficient than read due to not copying. Chunk boundaries do not correspond to peer writes, and hence cannot be used as framing.

pub fn read_to_end(self, size_limit: usize) -> ReadToEnd<S>

Notable traits for ReadToEnd<S>

impl<S> Future for ReadToEnd<S> where
    S: Session
type Output = Result<Vec<u8>, ReadToEndError>;
[src]

Convenience method to read all remaining data into a buffer

The returned future fails with ReadToEndError::TooLong if it’s longer than size_limit bytes. Uses unordered reads to be more efficient than using AsyncRead would allow. size_limit should be set to limit worst-case memory use.

If unordered reads have already been made, the resulting buffer may have gaps containing arbitrary data.

pub fn stop(&mut self, error_code: VarInt) -> Result<(), UnknownStream>[src]

Stop accepting data

Discards unread data and notifies the peer to stop transmitting. Once stopped, further attempts to operate on a stream will yield UnknownStream errors.

pub fn is_0rtt(&self) -> bool[src]

Check if this stream has been opened during 0-RTT.

In which case any non-idempotent request should be considered dangerous at the application level. Because read data is subject to replay attacks.

pub fn id(&self) -> StreamId[src]

Get the identity of this stream

Trait Implementations

impl<S> AsyncRead for RecvStream<S> where
    S: Session
[src]

impl<S> AsyncRead for RecvStream<S> where
    S: Session
[src]

impl<S: Debug> Debug for RecvStream<S> where
    S: Session
[src]

impl<S> Drop for RecvStream<S> where
    S: Session
[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for RecvStream<S>

impl<S> Send for RecvStream<S>

impl<S> Sync for RecvStream<S>

impl<S> Unpin for RecvStream<S>

impl<S> UnwindSafe for RecvStream<S>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,