Struct de_net::connection::delivery::confirms::ConfirmsBuffer
source · pub(super) struct ConfirmsBuffer {
oldest: Instant,
buffer: Vec<u8>,
flushed: usize,
}
Expand description
Buffer with datagram confirmations.
Fields§
§oldest: Instant
§buffer: Vec<u8>
§flushed: usize
Implementations§
source§impl ConfirmsBuffer
impl ConfirmsBuffer
pub(super) fn new() -> Self
pub(super) fn is_empty(&self) -> bool
sourcepub(super) fn push(&mut self, time: Instant, id: PackageId)
pub(super) fn push(&mut self, time: Instant, id: PackageId)
Pushes another datagram ID to the buffer.
sourcepub(super) async fn send_confirms(
&mut self,
time: Instant,
force: bool,
addr: SocketAddr,
datagrams: &mut Sender<OutDatagram>
) -> Result<Instant, SendError<OutDatagram>>
pub(super) async fn send_confirms( &mut self, time: Instant, force: bool, addr: SocketAddr, datagrams: &mut Sender<OutDatagram> ) -> Result<Instant, SendError<OutDatagram>>
Send package confirmation datagrams.
Not all confirmations are sent because there is a small delay to enable grouping.
§Arguments
-
time
- current time. -
force
- if true, all pending confirmations will be sent. -
datagrams
- output datagrams with the confirmations will be send to this channel.
§Returns
On success, it returns an estimation of the next resend schedule time. Next schedule time is guaranteed not to happen sooner than the returned time.
sourcefn expiration(&self) -> Option<Instant>
fn expiration(&self) -> Option<Instant>
Returns time when the buffer expires, i.e. time when it becomes necessary to flush the buffer and send the confirmations.
fn full(&self) -> bool
Auto Trait Implementations§
impl Freeze for ConfirmsBuffer
impl RefUnwindSafe for ConfirmsBuffer
impl Send for ConfirmsBuffer
impl Sync for ConfirmsBuffer
impl Unpin for ConfirmsBuffer
impl UnwindSafe for ConfirmsBuffer
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