pub fn new(mut run: Run) -> Result<Self, OpenError> {
        run.fix_splits();
        let len = run.len();
        if len == 0 {
            return Err(OpenError::EmptyRun);
        }

        let personal_best_time = run.segments().last().unwrap().personal_best_split_time();

        let mut editor = Self {
            run,
            selected_method: TimingMethod::RealTime,
            selected_segments: vec![0],
            previous_personal_best_time: personal_best_time,
            game_icon_id: CachedImageId::default(),
            segment_icon_ids: Vec::with_capacity(len),
            segment_times: Vec::with_capacity(len),
        };

        editor.update_segment_list();

        Ok(editor)
    }
/// Creates a new Run Editor that modifies the Run provided. Creation of the
/// Run Editor fails when a Run with no segments is provided.
Creates a new Run Editor that modifies the Run provided. Creation of the
Run Editor fails when a Run with no segments is provided.
Creates a new Run Editor that modifies the Run provided . Creation of the Run Editor fails when a Run with no segments is provided .
pub fn new(mut run: Run) -> Result<Self, OpenError> {
        run.fix_splits();
        let len = run.len();
        if len == 0 {
            return Err(OpenError::EmptyRun);
        }
        let personal_best_time = run.segments().last().unwrap().personal_best_split_time();
        let mut editor = Self {
            run,
            selected_method: TimingMethod::RealTime,
            selected_segments: vec![0],
            previous_personal_best_time: personal_best_time,
            game_icon_id: CachedImageId::default(),
            segment_icon_ids: Vec::with_capacity(len),
            segment_times: Vec::with_capacity(len),
        };
        editor.update_segment_list();
        Ok(editor)
    }
pub fn new ( mut run : Run ) -> Result < Self , OpenError > { run . fix_splits ( ) ; let len = run . len ( ) ; if len == 0 { return Err ( OpenError :: EmptyRun ) ; } let personal_best_time = run . segments ( ) . last ( ) . unwrap ( ) . personal_best_split_time ( ) ; let mut editor = Self { run , selected_method : TimingMethod :: RealTime , selected_segments : vec ! [ 0 ] , previous_personal_best_time : personal_best_time , game_icon_id : CachedImageId :: default ( ) , segment_icon_ids : Vec :: with_capacity ( len ) , segment_times : Vec :: with_capacity ( len ) , } ; editor . update_segment_list ( ) ; Ok ( editor ) }
Creates a new Run Editor that modifies the Run provided.
Creates a new Run Editor that modifies the Run provided .
run
Run
run
Run