Skip to main content

Receiver

Struct Receiver 

Source
pub struct Receiver { /* private fields */ }
Expand description

The receiving half: what a Receiver may accept next, and what it owes the Sender.

Implementations§

Source§

impl Receiver

Source

pub const fn new(params: Parameters) -> Self

A Receiver that has agreed params and taken nothing.

Source

pub const fn parameters(&self) -> &Parameters

The negotiated parameters.

Source

pub const fn received(&self) -> u64

How many octets have arrived.

Source

pub const fn is_complete(&self) -> bool

Whether the session has ended with a BlockAckEOF (§11.22.2.8).

Source

pub fn query(&mut self) -> Rejected<u32>

The Block Counter for the next BlockQuery or BlockQueryWithSkip (§11.22.6.2).

A query “implies a BlockAck of the previous block if no BlockAck was explicitly sent”, so asking for the next block also clears the outstanding acknowledgement.

Source

pub fn on_block(&mut self, counter: u32, len: usize, eof: bool) -> Rejected<()>

Takes a Block or BlockEOF (§11.22.6.4, §11.22.6.5).

len is the data length, which the caller has in hand either way; the data itself is the application’s to store.

Source

pub fn ack(&mut self) -> Rejected<(MessageType, u32)>

Acknowledges the block just taken: the opcode to send and the counter to put in it.

§11.22.6.6: the Block Counter “SHALL correspond to the Block Counter which was embedded in the Block being acknowledged”, so it is never the caller’s to choose.

Trait Implementations§

Source§

impl Debug for Receiver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.

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> Same for T

Source§

type Output = T

Should always be Self
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.