SyncSender

Struct SyncSender 

Source
pub struct SyncSender { /* private fields */ }
Available on crate feature sync only.
Expand description

Sender state for managing outbound sync messages

Implementations§

Source§

impl SyncSender

Source

pub fn new() -> Self

Create a new sender with default settings

Source

pub fn with_intervals( min_send_interval: Duration, collection_interval: Duration, delayed_ack_timeout: Duration, ) -> Self

Create a sender with custom intervals

Source

pub fn queue_message(&mut self, msg: SyncMessage)

Queue a message for sending

The message will be held until the pacing interval allows sending.

Source

pub fn should_send(&self) -> bool

Check if we should send now

Source

pub fn should_send_at(&self, now: Instant) -> bool

Check if we should send at a given time

Source

pub fn take_if_ready(&mut self) -> Option<SyncMessage>

Take the pending message if we should send now

Source

pub fn take_if_ready_at(&mut self, now: Instant) -> Option<SyncMessage>

Take the pending message if ready at a given time

Source

pub fn take_message(&mut self) -> Option<SyncMessage>

Force-take the pending message (bypass timing checks)

Source

pub fn time_until_send(&self) -> Option<Duration>

Get time until next allowed send

Source

pub fn time_until_send_at(&self, now: Instant) -> Option<Duration>

Get time until next allowed send at a given time

Source

pub fn has_pending(&self) -> bool

Check if there’s a pending message

Source

pub fn pending_message(&self) -> Option<&SyncMessage>

Get reference to pending message

Source

pub fn cancel_pending(&mut self)

Cancel pending message

Source

pub fn mark_ack_needed(&mut self)

Mark that an ack is needed (triggers delayed ack timer)

Source

pub fn reset(&mut self)

Reset sender state

Trait Implementations§

Source§

impl Debug for SyncSender

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SyncSender

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V