fn batch_add_time<BI, TS, BO>(batch: &BI, timestamp: &TS) -> BO
where
    TS: Timestamp,
    BI: BatchReader<Time = ()>,
    BI::Key: Clone,
    BI::Val: Clone,
    BO: Batch<Key = BI::Key, Val = BI::Val, Time = TS, R = BI::R>,
{
    let mut builder = BO::Builder::with_capacity(timestamp.clone(), batch.len());
    let mut cursor = batch.cursor();
    while cursor.key_valid(batch) {
        let key = cursor.key(batch);
        while cursor.val_valid(batch) {
            let val = cursor.val(batch);
            let w = cursor.weight(batch);
            builder.push((key.clone(), val.clone(), w.clone()));
            cursor.step_val(batch);
        }
        cursor.step_key(batch);
    }
    builder.done()
}
/// Add `timestamp` to all tuples in the input batch.
///
/// Given an input batch without timing information (`BatchReader::Time = ()`),
/// generate an output batch by adding the same time `timestamp` to
/// each tuple.
///
/// Most DBSP operators output untimed batches.  When such a batch is
/// added to a trace, the current timestamp must be added to it.
// TODO: this can be implemented more efficiently by having a special batch type
// where all updates have the same timestamp, as this is the only kind of
// batch that we ever create directly in DBSP; batches with multiple timestamps
// are only created as a result of merging.  The main complication is that
// we will need to extend the trace implementation to work with batches of
// multiple types.  This shouldn't be too hard and is on the todo list.
Add `timestamp` to all tuples in the input batch.
Given an input batch without timing information (`BatchReader::Time = ()`),
generate an output batch by adding the same time `timestamp` to
each tuple.

Most DBSP operators output untimed batches.  When such a batch is
added to a trace, the current timestamp must be added to it.
TODO: this can be implemented more efficiently by having a special batch type
where all updates have the same timestamp, as this is the only kind of
batch that we ever create directly in DBSP; batches with multiple timestamps
are only created as a result of merging.  The main complication is that
we will need to extend the trace implementation to work with batches of
multiple types.  This shouldn't be too hard and is on the todo list.
Add ` timestamp ` to all tuples in the input batch . Given an input batch without timing information ( ` BatchReader :: Time = () ` ) generate an output batch by adding the same time ` timestamp ` to each tuple . Most DBSP operators output untimed batches . When such a batch is added to a trace the current timestamp must be added to it . TODO : this can be implemented more efficiently by having a special batch type where all updates have the same timestamp as this is the only kind of batch that we ever create directly in DBSP ; batches with multiple timestamps are only created as a result of merging . The main complication is that we will need to extend the trace implementation to work with batches of multiple types . This shouldn ' t be too hard and is on the todo list .
fn batch_add_time<BI, TS, BO>(batch: &BI, timestamp: &TS) -> BO
where
    TS: Timestamp,
    BI: BatchReader<Time = ()>,
    BI::Key: Clone,
    BI::Val: Clone,
    BO: Batch<Key = BI::Key, Val = BI::Val, Time = TS, R = BI::R>,
{
    let mut builder = BO::Builder::with_capacity(timestamp.clone(), batch.len());
    let mut cursor = batch.cursor();
    while cursor.key_valid(batch) {
        let key = cursor.key(batch);
        while cursor.val_valid(batch) {
            let val = cursor.val(batch);
            let w = cursor.weight(batch);
            builder.push((key.clone(), val.clone(), w.clone()));
            cursor.step_val(batch);
        }
        cursor.step_key(batch);
    }
    builder.done()
}
fn batch_add_time < BI , TS , BO > ( batch : & BI , timestamp : & TS ) -> BO where TS : Timestamp , BI : BatchReader < Time = ( ) > , BI :: Key : Clone , BI :: Val : Clone , BO : Batch < Key = BI :: Key , Val = BI :: Val , Time = TS , R = BI :: R > , { let mut builder = BO :: Builder :: with_capacity ( timestamp . clone ( ) , batch . len ( ) ) ; let mut cursor = batch . cursor ( ) ; while cursor . key_valid ( batch ) { let key = cursor . key ( batch ) ; while cursor . val_valid ( batch ) { let val = cursor . val ( batch ) ; let w = cursor . weight ( batch ) ; builder . push ( ( key . clone ( ) , val . clone ( ) , w . clone ( ) ) ) ; cursor . step_val ( batch ) ; } cursor . step_key ( batch ) ; } builder . done ( ) }
Add `timestamp` to all tuples in the input batch.
Add ` timestamp ` to all tuples in the input batch .
batch
&BI
timestamp
&TS