/// create sample batches with variable number of records
create sample batches with variable number of records
create sample batches with variable number of records
fn create_batch(records: u16) -> DefaultBatch {
    let mut batches = DefaultBatch::default();
    let header = batches.get_mut_header();
    header.magic = 2;
    header.producer_id = 20;
    header.producer_epoch = -1;
    for i in 0..records {
        let msg = format!("record {}", i);
        let record: DefaultRecord = msg.into();
        batches.add_record(record);
    }
    batches
}
fn create_batch ( records : u16 ) -> DefaultBatch { let mut batches = DefaultBatch :: default ( ) ; let header = batches . get_mut_header ( ) ; header . magic = 2 ; header . producer_id = 20 ; header . producer_epoch = - 1 ; for i in 0 .. records { let msg = format ! ( " " i ) ; let record : DefaultRecord = msg . into ( ) ; batches . add_record ( record ) ; } batches }
create sample batches with variable number of records
create sample batches with variable number of records
records
u16