write_payload

Function write_payload 

Source
pub fn write_payload<R: Rng + ?Sized>(
    rng: &mut R,
    buf: &mut Vec<u8>,
    batch: Batch,
    limit_bytes: usize,
) -> Payload
Expand description

Pack whole \n-terminated lines into buf until the next sampled line does not fit the space left under limit_bytes. That overflowing line is dropped whole rather than sheared and ends the payload, so the packed datagram never exceeds limit_bytes and holds only whole lines. Each line takes its vibe from batch, so a Mixed payload interleaves clean and feral lines. Clears buf first.