pub fn update_state(&self, state: &mut key_value::State, timer: &Snapshot<'_>) {
        let comparison = comparison::resolve(&self.settings.comparison_override, timer);
        let comparison = comparison::or_current(comparison, timer);
        let key = self.text(Some(comparison));

        let (current_pace, updates_frequently) =
            if timer.current_phase() == TimerPhase::NotRunning && key.starts_with("Current Pace") {
                (None, false)
            } else {
                current_pace::calculate(timer, comparison)
            };

        state.background = self.settings.background;
        state.key_color = self.settings.label_color;
        state.value_color = self.settings.value_color;
        state.semantic_color = Default::default();

        state.key.clear();
        state.key.push_str(&key); // FIXME: Uncow this

        state.value.clear();
        let _ = write!(
            state.value,
            "{}",
            Regular::with_accuracy(self.settings.accuracy).format(current_pace)
        );

        state.key_abbreviations.clear();
        // FIXME: This &* probably is different when key is uncowed
        match &*key {
            "Best Possible Time" => {
                state.key_abbreviations.push("Best Poss. Time".into());
                state.key_abbreviations.push("Best Time".into());
                state.key_abbreviations.push("BPT".into());
            }
            "Worst Possible Time" => {
                state.key_abbreviations.push("Worst Poss. Time".into());
                state.key_abbreviations.push("Worst Time".into());
            }
            "Predicted Time" => {
                state.key_abbreviations.push("Pred. Time".into());
            }
            "Current Pace" => {
                state.key_abbreviations.push("Cur. Pace".into());
                state.key_abbreviations.push("Pace".into());
            }
            _ => {
                state.key_abbreviations.push("Current Pace".into());
                state.key_abbreviations.push("Cur. Pace".into());
                state.key_abbreviations.push("Pace".into());
            }
        }

        state.display_two_rows = self.settings.display_two_rows;
        state.updates_frequently = updates_frequently;
    }
/// Updates the component's state based on the timer provided.
Updates the component's state based on the timer provided.
Updates the component ' s state based on the timer provided .
pub fn update_state(&self, state: &mut key_value::State, timer: &Snapshot<'_>) {
        let comparison = comparison::resolve(&self.settings.comparison_override, timer);
        let comparison = comparison::or_current(comparison, timer);
        let key = self.text(Some(comparison));
        let (current_pace, updates_frequently) =
            if timer.current_phase() == TimerPhase::NotRunning && key.starts_with("Current Pace") {
                (None, false)
            } else {
                current_pace::calculate(timer, comparison)
            };
        state.background = self.settings.background;
        state.key_color = self.settings.label_color;
        state.value_color = self.settings.value_color;
        state.semantic_color = Default::default();
        state.key.clear();
        state.key.push_str(&key); // FIXME: Uncow this
        state.value.clear();
        let _ = write!(
            state.value,
            "{}",
            Regular::with_accuracy(self.settings.accuracy).format(current_pace)
        );
        state.key_abbreviations.clear();
        // FIXME: This &* probably is different when key is uncowed
        match &*key {
            "Best Possible Time" => {
                state.key_abbreviations.push("Best Poss. Time".into());
                state.key_abbreviations.push("Best Time".into());
                state.key_abbreviations.push("BPT".into());
            }
            "Worst Possible Time" => {
                state.key_abbreviations.push("Worst Poss. Time".into());
                state.key_abbreviations.push("Worst Time".into());
            }
            "Predicted Time" => {
                state.key_abbreviations.push("Pred. Time".into());
            }
            "Current Pace" => {
                state.key_abbreviations.push("Cur. Pace".into());
                state.key_abbreviations.push("Pace".into());
            }
            _ => {
                state.key_abbreviations.push("Current Pace".into());
                state.key_abbreviations.push("Cur. Pace".into());
                state.key_abbreviations.push("Pace".into());
            }
        }
        state.display_two_rows = self.settings.display_two_rows;
        state.updates_frequently = updates_frequently;
    }
pub fn update_state ( & self , state : & mut key_value :: State , timer : & Snapshot < ' _ > ) { let comparison = comparison :: resolve ( & self . settings . comparison_override , timer ) ; let comparison = comparison :: or_current ( comparison , timer ) ; let key = self . text ( Some ( comparison ) ) ; let ( current_pace , updates_frequently ) = if timer . current_phase ( ) == TimerPhase :: NotRunning && key . starts_with ( " " ) { ( None , false ) } else { current_pace :: calculate ( timer , comparison ) } ; state . background = self . settings . background ; state . key_color = self . settings . label_color ; state . value_color = self . settings . value_color ; state . semantic_color = Default :: default ( ) ; state . key . clear ( ) ; state . key . push_str ( & key ) ; // FIXME: Uncow this state . value . clear ( ) ; let _ = write ! ( state value " " Regular with_accuracy ( self settings accuracy ) format ( current_pace ) ) ; state . key_abbreviations . clear ( ) ; // FIXME: This &* probably is different when key is uncowed match & * key { " " => { state . key_abbreviations . push ( " " . into ( ) ) ; state . key_abbreviations . push ( " " . into ( ) ) ; state . key_abbreviations . push ( " " . into ( ) ) ; } " " => { state . key_abbreviations . push ( " " . into ( ) ) ; state . key_abbreviations . push ( " " . into ( ) ) ; } " " => { state . key_abbreviations . push ( " " . into ( ) ) ; } " " => { state . key_abbreviations . push ( " " . into ( ) ) ; state . key_abbreviations . push ( " " . into ( ) ) ; } _ => { state . key_abbreviations . push ( " " . into ( ) ) ; state . key_abbreviations . push ( " " . into ( ) ) ; state . key_abbreviations . push ( " " . into ( ) ) ; } } state . display_two_rows = self . settings . display_two_rows ; state . updates_frequently = updates_frequently ; }
Updates the component's state based on the timer provided.
Updates the component ' s state based on the timer provided .
&self
state
&mut key_value::State
timer
&Snapshot<'_>
&self
state
&mut key_value::State
timer
&Snapshot<'_>