nope, run needs timers with typestate

This commit is contained in:
Quaternions 2024-07-31 13:18:53 -07:00
parent 4247c2ef5a
commit 912ec33dbc

View File

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