nope, run needs timers with typestate
This commit is contained in:
parent
4247c2ef5a
commit
912ec33dbc
11
src/run.rs
11
src/run.rs
@ -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{
|
||||||
|
Loading…
Reference in New Issue
Block a user