fn schedule_timer(&mut self, timestamp: Timestamp, state: &State<C>) -> Vec<Effect<C>> {
        if self.next_timer > timestamp {
            return Vec::new(); // We already scheduled the next call; nothing to do.
        }
        let r_exp = self.round_exp(state, timestamp);
        let r_id = state::round_id(timestamp, r_exp);
        let r_len = state::round_len(r_exp);
        self.next_timer = if timestamp < r_id + self.witness_offset(r_len) {
            r_id + self.witness_offset(r_len)
        } else {
            let next_r_id = r_id + r_len;
            if state.leader(next_r_id) == self.vidx {
                next_r_id
            } else {
                let next_r_exp = self.round_exp(state, next_r_id);
                next_r_id + self.witness_offset(state::round_len(next_r_exp))
            }
        };
        vec![Effect::ScheduleTimer(self.next_timer)]
    }
/// Returns a `ScheduleTimer` effect for the next time we need to be called.
///
/// If the time is before the current round's witness unit, schedule the witness unit.
/// Otherwise, if we are the next round's leader, schedule the proposal unit.
/// Otherwise schedule the next round's witness unit.
Returns a `ScheduleTimer` effect for the next time we need to be called.
If the time is before the current round's witness unit, schedule the witness unit.
Otherwise, if we are the next round's leader, schedule the proposal unit.
Otherwise schedule the next round's witness unit.
Returns a ` ScheduleTimer ` effect for the next time we need to be called . If the time is before the current round ' s witness unit schedule the witness unit . Otherwise if we are the next round ' s leader schedule the proposal unit . Otherwise schedule the next round ' s witness unit .
fn schedule_timer(&mut self, timestamp: Timestamp, state: &State<C>) -> Vec<Effect<C>> {
        if self.next_timer > timestamp {
            return Vec::new(); // We already scheduled the next call; nothing to do.
        }
        let r_exp = self.round_exp(state, timestamp);
        let r_id = state::round_id(timestamp, r_exp);
        let r_len = state::round_len(r_exp);
        self.next_timer = if timestamp < r_id + self.witness_offset(r_len) {
            r_id + self.witness_offset(r_len)
        } else {
            let next_r_id = r_id + r_len;
            if state.leader(next_r_id) == self.vidx {
                next_r_id
            } else {
                let next_r_exp = self.round_exp(state, next_r_id);
                next_r_id + self.witness_offset(state::round_len(next_r_exp))
            }
        };
        vec![Effect::ScheduleTimer(self.next_timer)]
    }
fn schedule_timer ( & mut self , timestamp : Timestamp , state : & State < C > ) -> Vec < Effect < C > > { if self . next_timer > timestamp { return Vec :: new ( ) ; // We already scheduled the next call; nothing to do. } let r_exp = self . round_exp ( state , timestamp ) ; let r_id = state :: round_id ( timestamp , r_exp ) ; let r_len = state :: round_len ( r_exp ) ; self . next_timer = if timestamp < r_id + self . witness_offset ( r_len ) { r_id + self . witness_offset ( r_len ) } else { let next_r_id = r_id + r_len ; if state . leader ( next_r_id ) == self . vidx { next_r_id } else { let next_r_exp = self . round_exp ( state , next_r_id ) ; next_r_id + self . witness_offset ( state :: round_len ( next_r_exp ) ) } } ; vec ! [ Effect ScheduleTimer ( self next_timer ) ] }
Returns a `ScheduleTimer` effect for the next time we need to be called.
Returns a ` ScheduleTimer ` effect for the next time we need to be called .
&mut self
timestamp
Timestamp
state
&State<C>
&mut self
timestamp
Timestamp
state
&State<C>