pub struct SentPackets { /* private fields */ }
Implementations§
Source§impl SentPackets
impl SentPackets
Sourcepub fn new(init_seq_num: u16, congestion_ctrl: Controller) -> Self
pub fn new(init_seq_num: u16, congestion_ctrl: Controller) -> Self
Note: init_seq_num
corresponds to the sequence number just before the sequence number of
the first packet to track.
pub fn next_seq_num(&self) -> u16
pub fn ack_num(&self) -> u16
pub fn seq_num_range(&self) -> CircularRangeInclusive ⓘ
pub fn timeout(&self) -> Duration
pub fn on_timeout(&mut self)
pub fn window(&self) -> u32
pub fn has_unacked_packets(&self) -> bool
pub fn has_lost_packets(&self) -> bool
pub fn lost_packets(&self) -> Vec<(u16, PacketType, Option<Vec<u8>>)>
Sourcepub fn on_transmit(
&mut self,
seq_num: u16,
packet_type: PacketType,
data: Option<Vec<u8>>,
len: u32,
now: Instant,
)
pub fn on_transmit( &mut self, seq_num: u16, packet_type: PacketType, data: Option<Vec<u8>>, len: u32, now: Instant, )
§Panics
Panics if seq_num
does not correspond to the next expected packet or a previously sent
packet.
Panics if the transmit is not a retransmission and len
is greater than the amount of
available space in the window.
Sourcepub fn on_ack(
&mut self,
ack_num: u16,
selective_ack: Option<&SelectiveAck>,
delay: Duration,
now: Instant,
) -> Result<(CircularRangeInclusive, Vec<u16>), SentPacketsError>
pub fn on_ack( &mut self, ack_num: u16, selective_ack: Option<&SelectiveAck>, delay: Duration, now: Instant, ) -> Result<(CircularRangeInclusive, Vec<u16>), SentPacketsError>
Handle an ACK for a packet with sequence number ack_num
, and an optional selective_ack.
Returns Error, if ack_num
is not within the sequence number range of the sent packets.
Sourcepub fn last_ack_num(&self) -> Option<u16>
pub fn last_ack_num(&self) -> Option<u16>
Returns the sequence number of the last (i.e. latest) packet in a contiguous sequence of acknowledged packets.
Returns None
if none of the (possibly zero) packets have been acknowledged.
Trait Implementations§
Source§impl Clone for SentPackets
impl Clone for SentPackets
Source§fn clone(&self) -> SentPackets
fn clone(&self) -> SentPackets
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for SentPackets
impl RefUnwindSafe for SentPackets
impl Send for SentPackets
impl Sync for SentPackets
impl Unpin for SentPackets
impl UnwindSafe for SentPackets
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