Skip to main content

PossibleGapBuffer

Struct PossibleGapBuffer 

Source
pub struct PossibleGapBuffer { /* private fields */ }
Expand description

Buffers updates received during a possible-gap window so we don’t fire getDifference on every slightly out-of-order update.

Implementations§

Source§

impl PossibleGapBuffer

Source

pub fn new() -> Self

Source

pub fn push_global(&mut self, upd: Update)

Buffer a global update during a possible-gap window.

Source

pub fn push_channel(&mut self, channel_id: i64, upd: Update)

Buffer a channel update during a possible-gap window.

Source

pub fn global_deadline_elapsed(&self) -> bool

True if the global possible-gap deadline has elapsed.

Source

pub fn channel_deadline_elapsed(&self, channel_id: i64) -> bool

True if a channel’s possible-gap deadline has elapsed.

Source

pub fn has_global(&self) -> bool

True if the global buffer has any pending updates.

Source

pub fn has_channel(&self, channel_id: i64) -> bool

True if a channel buffer has pending updates.

Source

pub fn drain_global(&mut self) -> Vec<Update>

Drain global buffered updates.

Source

pub fn drain_channel(&mut self, channel_id: i64) -> Vec<Update>

Drain channel buffered updates.

Trait Implementations§

Source§

impl Default for PossibleGapBuffer

Source§

fn default() -> PossibleGapBuffer

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.