pub struct Batch { /* private fields */ }Available on crate feature
extensions only.Expand description
A batch of updates ready for transmission
Implementations§
Source§impl Batch
impl Batch
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create batch with capacity hint
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Total payload bytes (excluding headers)
Sourcepub fn try_add(&mut self, update: Vec<u8>, config: &BatchingConfig) -> bool
pub fn try_add(&mut self, update: Vec<u8>, config: &BatchingConfig) -> bool
Add an update to the batch
Returns false if the update doesn’t fit (caller should flush first).
Sourcepub fn decode(data: &[u8]) -> Result<Self, NegotiationError>
pub fn decode(data: &[u8]) -> Result<Self, NegotiationError>
Decode batch from wire format
Sourcepub fn into_updates(self) -> Vec<Vec<u8>>
pub fn into_updates(self) -> Vec<Vec<u8>>
Consume batch and return updates
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Batch
impl RefUnwindSafe for Batch
impl Send for Batch
impl Sync for Batch
impl Unpin for Batch
impl UnwindSafe for Batch
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