pub enum BatchMode {
Fixed(NonZeroUsize),
Adaptive(NonZeroUsize, Duration),
Single,
}
Expand description
Which policy to use for batching the messages before sending them.
Avoid constructing directly this enumeration, please use BatchMode::fixed()
and
BatchMode::adaptive()
constructors.
The default batch mode is Adaptive(1024, 50ms)
, meaning that a batch is flushed either when
it has at least 1024 messages, or no message has been received in the last 50ms.
Variants§
Fixed(NonZeroUsize)
A batch is flushed only when the specified number of messages is present.
Adaptive(NonZeroUsize, Duration)
A batch is flushed only when the specified number of messages is present or a timeout expires.
Single
Send each message infdividually
Implementations§
source§impl BatchMode
impl BatchMode
sourcepub fn fixed(size: usize) -> BatchMode
pub fn fixed(size: usize) -> BatchMode
Construct a new BatchMode::Fixed
with the given positive batch size.
sourcepub fn adaptive(size: usize, max_delay: Duration) -> BatchMode
pub fn adaptive(size: usize, max_delay: Duration) -> BatchMode
Construct a new BatchMode::Adaptive
with the given positive batch size and maximum delay.
pub fn max_delay(&self) -> Option<Duration>
Trait Implementations§
source§impl PartialEq for BatchMode
impl PartialEq for BatchMode
impl Copy for BatchMode
impl Eq for BatchMode
impl StructuralPartialEq for BatchMode
Auto Trait Implementations§
impl RefUnwindSafe for BatchMode
impl Send for BatchMode
impl Sync for BatchMode
impl Unpin for BatchMode
impl UnwindSafe for BatchMode
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
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.