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§
impl Copy for BatchMode
impl Eq for BatchMode
impl StructuralPartialEq for BatchMode
Auto Trait Implementations§
impl Freeze for BatchMode
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
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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