Skip to main content

AnySubgroupReader

Enum AnySubgroupReader 

Source
pub enum AnySubgroupReader {
Show 15 variants Draft07(FramedRecvStream), Draft08(FramedRecvStream), Draft09(FramedRecvStream), Draft10(FramedRecvStream), Draft11(FramedRecvStream), Draft12(FramedRecvStream), Draft13(FramedRecvStream), Draft14(FramedRecvStream), Draft15(FramedRecvStream), Draft16(FramedRecvStream), Draft17(FramedRecvStream), Draft18(FramedRecvStream), Draft19(FramedRecvStream), Draft20(FramedRecvStream), Draft21(FramedRecvStream),
}
Expand description

A subgroup stream the peer opened, that this endpoint is reading.

The mirror of AnySubgroupWriter, returned by AnyConnection::accept_subgroup beside the header the peer framed it with.

Variants§

§

Draft07(FramedRecvStream)

Draft-07’s subgroup stream.

§

Draft08(FramedRecvStream)

Draft-08’s subgroup stream.

§

Draft09(FramedRecvStream)

Draft-09’s subgroup stream.

§

Draft10(FramedRecvStream)

Draft-10’s subgroup stream.

§

Draft11(FramedRecvStream)

Draft-11’s subgroup stream.

§

Draft12(FramedRecvStream)

Draft-12’s subgroup stream.

§

Draft13(FramedRecvStream)

Draft-13’s subgroup stream.

§

Draft14(FramedRecvStream)

Draft-14’s subgroup stream.

§

Draft15(FramedRecvStream)

Draft-15’s subgroup stream.

§

Draft16(FramedRecvStream)

Draft-16’s subgroup stream.

§

Draft17(FramedRecvStream)

Draft-17’s subgroup stream.

§

Draft18(FramedRecvStream)

Draft-18’s subgroup stream.

§

Draft19(FramedRecvStream)

Draft-19’s subgroup stream.

§

Draft20(FramedRecvStream)

Draft-20’s subgroup stream.

§

Draft21(FramedRecvStream)

Draft-21’s subgroup stream.

Implementations§

Source§

impl AnySubgroupReader

Source

pub fn draft(&self) -> DraftVersion

The draft framing this stream.

Source

pub fn stream_id(&self) -> u64

Which stream this subgroup arrived on, on the terms AnySubgroupWriter::stream_id describes.

Source

pub async fn read_object(&mut self) -> Result<AnyObject, AnyConnectionError>

Read the next object on this subgroup.

§The stream’s end arrives as an error, not as None

A subgroup ends when its stream ends, and none of the per-draft readers can tell that end from a truncation: both leave the reader wanting bytes that never come, and both surface as ConnectionError::UnexpectedEnd. Returning Option here would have to invent the distinction, and inventing it means reporting a stream the peer cut off mid-object as a subgroup that finished — which is exactly the case a caller most needs to know about.

So a caller that expects a known number of objects reads that many, and one that does not treats the error as the end and keeps whatever it read before it. Neither has to guess.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more