pub struct SyncSender { /* private fields */ }Available on crate feature
sync only.Expand description
Sender state for managing outbound sync messages
Implementations§
Source§impl SyncSender
impl SyncSender
Sourcepub fn with_intervals(
min_send_interval: Duration,
collection_interval: Duration,
delayed_ack_timeout: Duration,
) -> Self
pub fn with_intervals( min_send_interval: Duration, collection_interval: Duration, delayed_ack_timeout: Duration, ) -> Self
Create a sender with custom intervals
Sourcepub fn queue_message(&mut self, msg: SyncMessage)
pub fn queue_message(&mut self, msg: SyncMessage)
Queue a message for sending
The message will be held until the pacing interval allows sending.
Sourcepub fn should_send(&self) -> bool
pub fn should_send(&self) -> bool
Check if we should send now
Sourcepub fn should_send_at(&self, now: Instant) -> bool
pub fn should_send_at(&self, now: Instant) -> bool
Check if we should send at a given time
Sourcepub fn take_if_ready(&mut self) -> Option<SyncMessage>
pub fn take_if_ready(&mut self) -> Option<SyncMessage>
Take the pending message if we should send now
Sourcepub fn take_if_ready_at(&mut self, now: Instant) -> Option<SyncMessage>
pub fn take_if_ready_at(&mut self, now: Instant) -> Option<SyncMessage>
Take the pending message if ready at a given time
Sourcepub fn take_message(&mut self) -> Option<SyncMessage>
pub fn take_message(&mut self) -> Option<SyncMessage>
Force-take the pending message (bypass timing checks)
Sourcepub fn time_until_send(&self) -> Option<Duration>
pub fn time_until_send(&self) -> Option<Duration>
Get time until next allowed send
Sourcepub fn time_until_send_at(&self, now: Instant) -> Option<Duration>
pub fn time_until_send_at(&self, now: Instant) -> Option<Duration>
Get time until next allowed send at a given time
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Check if there’s a pending message
Sourcepub fn pending_message(&self) -> Option<&SyncMessage>
pub fn pending_message(&self) -> Option<&SyncMessage>
Get reference to pending message
Sourcepub fn cancel_pending(&mut self)
pub fn cancel_pending(&mut self)
Cancel pending message
Sourcepub fn mark_ack_needed(&mut self)
pub fn mark_ack_needed(&mut self)
Mark that an ack is needed (triggers delayed ack timer)
Trait Implementations§
Source§impl Debug for SyncSender
impl Debug for SyncSender
Auto Trait Implementations§
impl Freeze for SyncSender
impl RefUnwindSafe for SyncSender
impl Send for SyncSender
impl Sync for SyncSender
impl Unpin for SyncSender
impl UnwindSafe for SyncSender
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