pub struct MessageDebouncer { /* private fields */ }Expand description
Message debouncer that delays and coalesces rapid notifications.
Implementations§
Source§impl MessageDebouncer
impl MessageDebouncer
Sourcepub fn new(config: DebouncingConfig) -> Self
pub fn new(config: DebouncingConfig) -> Self
Create a new message debouncer.
Sourcepub async fn add(&self, key: String, notification: Notification) -> Result<()>
pub async fn add(&self, key: String, notification: Notification) -> Result<()>
Add a notification to be debounced.
Sourcepub async fn receive(&self) -> Option<Notification>
pub async fn receive(&self) -> Option<Notification>
Receive the next debounced notification.
Sourcepub async fn flush(&self) -> Vec<Notification>
pub async fn flush(&self) -> Vec<Notification>
Flush all pending notifications immediately.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageDebouncer
impl !RefUnwindSafe for MessageDebouncer
impl Send for MessageDebouncer
impl Sync for MessageDebouncer
impl Unpin for MessageDebouncer
impl !UnwindSafe for MessageDebouncer
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