StreamsHandler

Struct StreamsHandler 

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

In charge of handling the acknowledge listeners for Stream Messages so that it knows that it has to send the next StreamMessage

Implementations§

Source§

impl StreamsHandler

Source

pub fn new() -> Self

Source

pub async fn send_streams_through_transport<T: Transport + ?Sized>( &self, transport: Arc<T>, stream_generator: Generator<Vec<u8>>, port_id: u32, message_number: u32, ) -> Result<(), CommonError>

As it receives encoded messages from the stream_generator, it’ll be sending StreamMessages through the given transport in the parameters.

It handles the sequence id for each StreamMessage, it’ll await for the acknowlegde of each message in the other half to conitnue with the messages sending.

Also, it stops the generator and break the loop if the other half closed the stream. Otherwise, it will close the stream when the stream_generator doesn’t have more messages.

Source

pub fn message_acknowledged_by_peer( self: Arc<Self>, message_number: u32, payload: Vec<u8>, )

Notify the acknowledge listener registered in send_stream that the message was acknowledge by the other peer and it can continue sending the pending messages

Trait Implementations§

Source§

impl Default for StreamsHandler

Source§

fn default() -> StreamsHandler

Returns the “default value” for a type. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.