pub struct MessageBatch { /* private fields */ }Expand description
Batch of messages for efficient processing
Implementations§
Source§impl MessageBatch
impl MessageBatch
Sourcepub fn with_capacity(max_size: usize) -> Self
pub fn with_capacity(max_size: usize) -> Self
Create a new message batch with specified max size
Sourcepub fn push(&mut self, message: Message) -> bool
pub fn push(&mut self, message: Message) -> bool
Add a message to the batch
Returns true if the message was added, false if the batch is full
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Validate all messages in the batch
Sourcepub fn split(self, chunk_size: usize) -> Vec<MessageBatch>
pub fn split(self, chunk_size: usize) -> Vec<MessageBatch>
Split the batch into smaller batches of the specified size
Sourcepub fn merge(&mut self, other: MessageBatch) -> Vec<Message>
pub fn merge(&mut self, other: MessageBatch) -> Vec<Message>
Merge another batch into this one
Returns the messages that didn’t fit if the combined size exceeds max_size
Trait Implementations§
Source§impl AsMut<[Message]> for MessageBatch
impl AsMut<[Message]> for MessageBatch
Source§impl AsRef<[Message]> for MessageBatch
impl AsRef<[Message]> for MessageBatch
Source§impl Clone for MessageBatch
impl Clone for MessageBatch
Source§fn clone(&self) -> MessageBatch
fn clone(&self) -> MessageBatch
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageBatch
impl Debug for MessageBatch
Source§impl Default for MessageBatch
impl Default for MessageBatch
Source§impl Extend<Message> for MessageBatch
impl Extend<Message> for MessageBatch
Source§fn extend<T: IntoIterator<Item = Message>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Message>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<Message> for MessageBatch
impl FromIterator<Message> for MessageBatch
Source§impl Index<usize> for MessageBatch
impl Index<usize> for MessageBatch
Source§impl IndexMut<usize> for MessageBatch
impl IndexMut<usize> for MessageBatch
Source§impl<'a> IntoIterator for &'a MessageBatch
impl<'a> IntoIterator for &'a MessageBatch
Source§impl<'a> IntoIterator for &'a mut MessageBatch
impl<'a> IntoIterator for &'a mut MessageBatch
Auto Trait Implementations§
impl Freeze for MessageBatch
impl RefUnwindSafe for MessageBatch
impl Send for MessageBatch
impl Sync for MessageBatch
impl Unpin for MessageBatch
impl UnwindSafe for MessageBatch
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