Struct veloren_network_protocol::tcp::TcpSendProtocol
source · pub struct TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,{
buffer: BytesMut,
store: PrioManager,
next_mid: u64,
closing_streams: Vec<Sid>,
notify_closing_streams: Vec<Sid>,
pending_shutdown: bool,
drain: D,
last: Instant,
metrics: ProtocolMetricCache,
}
Expand description
TCP implementation of SendProtocol
Fields§
§buffer: BytesMut
§store: PrioManager
§next_mid: u64
§closing_streams: Vec<Sid>
§notify_closing_streams: Vec<Sid>
§pending_shutdown: bool
§drain: D
§last: Instant
§metrics: ProtocolMetricCache
Implementations§
source§impl<D> TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,
impl<D> TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,
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 TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut> + Debug,
impl<D> Debug for TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut> + Debug,
source§impl<D> ReliableDrain for TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,
impl<D> ReliableDrain for TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,
source§impl<D> SendProtocol for TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,
impl<D> SendProtocol for TcpSendProtocol<D>where
D: UnreliableDrain<DataFormat = BytesMut>,
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 TcpSendProtocol<D>where
D: Freeze,
impl<D> !RefUnwindSafe for TcpSendProtocol<D>
impl<D> Send for TcpSendProtocol<D>
impl<D> Sync for TcpSendProtocol<D>where
D: Sync,
impl<D> Unpin for TcpSendProtocol<D>where
D: Unpin,
impl<D> !UnwindSafe for TcpSendProtocol<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