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

        let (delta, use_live_delta) = delta::calculate(timer, comparison);

        let mut index = timer.current_split_index();
        if !use_live_delta {
            index = index.and_then(|i| i.checked_sub(1));
        }

        let semantic_color = if let Some(index) = index {
            state_helper::split_color(
                timer,
                delta,
                index,
                true,
                false,
                comparison,
                timer.current_timing_method(),
            )
        } else {
            SemanticColor::Default
        };

        let value_color = Some(semantic_color.visualize(layout_settings));

        state.background = self.settings.background;
        state.key_color = self.settings.label_color;
        state.value_color = value_color;

        state.key.clear();
        state.key.push_str(text);

        state.value.clear();
        let _ = write!(
            state.value,
            "{}",
            Delta::custom(self.settings.drop_decimals, self.settings.accuracy).format(delta),
        );

        state.key_abbreviations.clear();
        if let Some(abbreviation) = comparison::try_shorten(text) {
            state.key_abbreviations.push(abbreviation.into());
        }

        state.display_two_rows = self.settings.display_two_rows;
        state.updates_frequently = use_live_delta;
    }
/// Updates the component's state based on the timer and layout settings
/// provided.
Updates the component's state based on the timer and layout settings
provided.
Updates the component ' s state based on the timer and layout settings provided .
pub fn update_state(
        &self,
        state: &mut key_value::State,
        timer: &Snapshot<'_>,
        layout_settings: &GeneralLayoutSettings,
    ) {
        let comparison = comparison::resolve(&self.settings.comparison_override, timer);
        let text = comparison.unwrap_or_else(|| timer.current_comparison());
        let comparison = comparison::or_current(comparison, timer);
        let (delta, use_live_delta) = delta::calculate(timer, comparison);
        let mut index = timer.current_split_index();
        if !use_live_delta {
            index = index.and_then(|i| i.checked_sub(1));
        }
        let semantic_color = if let Some(index) = index {
            state_helper::split_color(
                timer,
                delta,
                index,
                true,
                false,
                comparison,
                timer.current_timing_method(),
            )
        } else {
            SemanticColor::Default
        };
        let value_color = Some(semantic_color.visualize(layout_settings));
        state.background = self.settings.background;
        state.key_color = self.settings.label_color;
        state.value_color = value_color;
        state.key.clear();
        state.key.push_str(text);
        state.value.clear();
        let _ = write!(
            state.value,
            "{}",
            Delta::custom(self.settings.drop_decimals, self.settings.accuracy).format(delta),
        );
        state.key_abbreviations.clear();
        if let Some(abbreviation) = comparison::try_shorten(text) {
            state.key_abbreviations.push(abbreviation.into());
        }
        state.display_two_rows = self.settings.display_two_rows;
        state.updates_frequently = use_live_delta;
    }
pub fn update_state ( & self , state : & mut key_value :: State , timer : & Snapshot < ' _ > , layout_settings : & GeneralLayoutSettings , ) { let comparison = comparison :: resolve ( & self . settings . comparison_override , timer ) ; let text = comparison . unwrap_or_else ( | | timer . current_comparison ( ) ) ; let comparison = comparison :: or_current ( comparison , timer ) ; let ( delta , use_live_delta ) = delta :: calculate ( timer , comparison ) ; let mut index = timer . current_split_index ( ) ; if ! use_live_delta { index = index . and_then ( | i | i . checked_sub ( 1 ) ) ; } let semantic_color = if let Some ( index ) = index { state_helper :: split_color ( timer , delta , index , true , false , comparison , timer . current_timing_method ( ) , ) } else { SemanticColor :: Default } ; let value_color = Some ( semantic_color . visualize ( layout_settings ) ) ; state . background = self . settings . background ; state . key_color = self . settings . label_color ; state . value_color = value_color ; state . key . clear ( ) ; state . key . push_str ( text ) ; state . value . clear ( ) ; let _ = write ! ( state value " " Delta custom ( self settings drop_decimals self settings accuracy ) format ( delta ) ) ; state . key_abbreviations . clear ( ) ; if let Some ( abbreviation ) = comparison :: try_shorten ( text ) { state . key_abbreviations . push ( abbreviation . into ( ) ) ; } state . display_two_rows = self . settings . display_two_rows ; state . updates_frequently = use_live_delta ; }
Updates the component's state based on the timer and layout settings
provided.
Updates the component ' s state based on the timer and layout settings provided .
&self
state
&mut key_value::State
timer
&Snapshot<'_>
layout_settings
&GeneralLayoutSettings
&self
state
&mut key_value::State
timer
&Snapshot<'_>
layout_settings
&GeneralLayoutSettings