pub fn rename_comparison(&mut self, old: &str, new: &str) -> Result<(), RenameError> {
        if old == new {
            return Ok(());
        }

        self.run
            .validate_comparison_name(new)
            .context(InvalidName)?;

        {
            let comparison_name = self
                .run
                .custom_comparisons_mut()
                .iter_mut()
                .find(|c| *c == old)
                .context(OldNameNotFound)?;

            comparison_name.clear();
            comparison_name.push_str(new);
        }

        for segment in self.run.segments_mut() {
            if let Some(time) = segment.comparisons_mut().remove(old) {
                *segment.comparison_mut(new) = time;
            }
        }

        self.fix();

        Ok(())
    }
/// Renames a comparison. The comparison can't be renamed if the new name of
/// the comparison starts with `[Race]` or it already exists.
Renames a comparison. The comparison can't be renamed if the new name of
the comparison starts with `[Race]` or it already exists.
Renames a comparison . The comparison can ' t be renamed if the new name of the comparison starts with ` [ Race ] ` or it already exists .
pub fn rename_comparison(&mut self, old: &str, new: &str) -> Result<(), RenameError> {
        if old == new {
            return Ok(());
        }
        self.run
            .validate_comparison_name(new)
            .context(InvalidName)?;
        {
            let comparison_name = self
                .run
                .custom_comparisons_mut()
                .iter_mut()
                .find(|c| *c == old)
                .context(OldNameNotFound)?;
            comparison_name.clear();
            comparison_name.push_str(new);
        }
        for segment in self.run.segments_mut() {
            if let Some(time) = segment.comparisons_mut().remove(old) {
                *segment.comparison_mut(new) = time;
            }
        }
        self.fix();
        Ok(())
    }
pub fn rename_comparison ( & mut self , old : & str , new : & str ) -> Result < ( ) , RenameError > { if old == new { return Ok ( ( ) ) ; } self . run . validate_comparison_name ( new ) . context ( InvalidName ) ? ; { let comparison_name = self . run . custom_comparisons_mut ( ) . iter_mut ( ) . find ( | c | * c == old ) . context ( OldNameNotFound ) ? ; comparison_name . clear ( ) ; comparison_name . push_str ( new ) ; } for segment in self . run . segments_mut ( ) { if let Some ( time ) = segment . comparisons_mut ( ) . remove ( old ) { * segment . comparison_mut ( new ) = time ; } } self . fix ( ) ; Ok ( ( ) ) }
Renames a comparison.
Renames a comparison .
&mut self
old
&str
new
&str
&mut self
old
&str
new
&str