nope, run needs timers with typestate

This commit is contained in:
Quaternions 2024-07-31 13:18:53 -07:00
parent 56ccc4b58b
commit db4ba34a42

View File

@ -7,7 +7,6 @@ pub enum InvalidationReason{
#[derive(Debug)]
pub enum Error{
Timer(TimerError),
AlreadyStarted,
NotStarted,
AlreadyFinished,
@ -19,12 +18,16 @@ impl std::fmt::Display for Error{
}
impl std::error::Error for Error{}
enum RunState{
Created{timer:Timer<Paused>},
Started{timer:Timer<Unpaused>},
Finished{timer:Timer<Paused>},
}
pub struct Run{
timer:Timer<Scaled>,
invalidated:Option<InvalidationReason>,
created:Time,
started:Option<Time>,
finished:Option<Time>,
state:RunState,
}
impl Run{