Struct veloren_network_protocol::mpsc::MpscSendProtocol
source · pub struct MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,{
drain: D,
last: Instant,
metrics: ProtocolMetricCache,
}
Expand description
MPSC implementation of SendProtocol
Fields§
§drain: D
§last: Instant
§metrics: ProtocolMetricCache
Implementations§
source§impl<D> MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,
impl<D> MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,
pub fn new(drain: D, metrics: ProtocolMetricCache) -> Self
sourcepub fn supported_promises() -> Promises
pub fn supported_promises() -> Promises
returns all promises that this Protocol can take care of If you open a Stream anyway, unsupported promises are ignored.
Trait Implementations§
source§impl<D> Debug for MpscSendProtocol<D>
impl<D> Debug for MpscSendProtocol<D>
source§impl<D> ReliableDrain for MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,
impl<D> ReliableDrain for MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,
source§impl<D> SendProtocol for MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,
impl<D> SendProtocol for MpscSendProtocol<D>where
D: UnreliableDrain<DataFormat = MpscMsg>,
type CustomErr = <D as UnreliableDrain>::CustomErr
source§fn notify_from_recv(&mut self, _event: ProtocolEvent)
fn notify_from_recv(&mut self, _event: ProtocolEvent)
YOU MUST inform the
SendProtocol
by any Stream Open BEFORE using it in
send
and Stream Close AFTER using it in send
via this fn.source§fn send<'life0, 'async_trait>(
&'life0 mut self,
event: ProtocolEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ProtocolError<Self::CustomErr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
event: ProtocolEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ProtocolError<Self::CustomErr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a Event via this Protocol. The
SendProtocol
MAY require flush
to be called before actual data is send to the respective Sink
.Auto Trait Implementations§
impl<D> Freeze for MpscSendProtocol<D>where
D: Freeze,
impl<D> !RefUnwindSafe for MpscSendProtocol<D>
impl<D> Send for MpscSendProtocol<D>
impl<D> Sync for MpscSendProtocol<D>where
D: Sync,
impl<D> Unpin for MpscSendProtocol<D>where
D: Unpin,
impl<D> !UnwindSafe for MpscSendProtocol<D>
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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