pub struct BatchTransformer {
pub size: usize,
/* private fields */
}Expand description
Transformer that batches events by accumulation.
Accumulates stream data values until size items are collected,
then emits them as a single JSON array. This reduces overhead for
high-volume token streaming by coalescing small chunks into fewer
deliveries.
Use flush() to retrieve any remaining buffered items
before the transformer is dropped.
Fields§
§size: usizeMaximum number of items to accumulate before emitting a batch.
Implementations§
Source§impl BatchTransformer
impl BatchTransformer
Sourcepub fn new(size: usize) -> BatchTransformer
pub fn new(size: usize) -> BatchTransformer
Create a new BatchTransformer with the given batch size.
A size of 0 is clamped to 1 to ensure forward progress.
Trait Implementations§
Source§impl Clone for BatchTransformer
impl Clone for BatchTransformer
Source§fn clone(&self) -> BatchTransformer
fn clone(&self) -> BatchTransformer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BatchTransformer
impl Debug for BatchTransformer
Auto Trait Implementations§
impl !Freeze for BatchTransformer
impl RefUnwindSafe for BatchTransformer
impl Send for BatchTransformer
impl Sync for BatchTransformer
impl Unpin for BatchTransformer
impl UnsafeUnpin for BatchTransformer
impl UnwindSafe for BatchTransformer
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