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
impl StreamsHandler
pub fn new() -> Self
Sourcepub 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>
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.
Sourcepub fn message_acknowledged_by_peer(
self: Arc<Self>,
message_number: u32,
payload: Vec<u8>,
)
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
impl Default for StreamsHandler
Source§fn default() -> StreamsHandler
fn default() -> StreamsHandler
Auto Trait Implementations§
impl !Freeze for StreamsHandler
impl !RefUnwindSafe for StreamsHandler
impl Send for StreamsHandler
impl Sync for StreamsHandler
impl Unpin for StreamsHandler
impl !UnwindSafe for StreamsHandler
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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