pub struct EventBatcher { /* private fields */ }Expand description
Batching utility for accumulating events before processing.
Implementations§
Source§impl EventBatcher
impl EventBatcher
Sourcepub fn add(&mut self, event: Box<dyn Event>) -> Option<Vec<Box<dyn Event>>>
pub fn add(&mut self, event: Box<dyn Event>) -> Option<Vec<Box<dyn Event>>>
Add an event to the current batch
Sourcepub fn should_flush(&self) -> bool
pub fn should_flush(&self) -> bool
Check if the batch should be flushed
Sourcepub fn flush(&mut self) -> Option<Vec<Box<dyn Event>>>
pub fn flush(&mut self) -> Option<Vec<Box<dyn Event>>>
Flush the current batch and return the events
Sourcepub fn current_size(&self) -> usize
pub fn current_size(&self) -> usize
Get the current batch size
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EventBatcher
impl !UnwindSafe for EventBatcher
impl Freeze for EventBatcher
impl Send for EventBatcher
impl Sync for EventBatcher
impl Unpin for EventBatcher
impl UnsafeUnpin for EventBatcher
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