TimerFixed is Copy
This commit is contained in:
parent
7736a1f8a2
commit
1751356e3c
10
src/timer.rs
10
src/timer.rs
@ -1,9 +1,11 @@
|
||||
use crate::integer::{Time,Ratio64};
|
||||
|
||||
#[derive(Clone,Copy,Debug)]
|
||||
pub struct Paused;
|
||||
#[derive(Clone,Copy,Debug)]
|
||||
pub struct Unpaused;
|
||||
|
||||
pub trait PauseState{
|
||||
pub trait PauseState:Copy{
|
||||
const IS_PAUSED:bool;
|
||||
fn new()->Self;
|
||||
}
|
||||
@ -20,6 +22,7 @@ impl PauseState for Unpaused{
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,Debug)]
|
||||
pub struct Realtime{
|
||||
offset:Time,
|
||||
}
|
||||
@ -28,6 +31,8 @@ impl Realtime{
|
||||
Self{offset:Time::ZERO}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,Debug)]
|
||||
pub struct Scaled{
|
||||
scale:Ratio64,
|
||||
offset:Time,
|
||||
@ -52,7 +57,7 @@ impl Scaled{
|
||||
}
|
||||
}
|
||||
|
||||
pub trait TimerState{
|
||||
pub trait TimerState:Copy{
|
||||
fn get_time(&self,time:Time)->Time;
|
||||
fn set_time(&mut self,time:Time,new_time:Time);
|
||||
fn get_offset(&self)->Time;
|
||||
@ -87,6 +92,7 @@ impl TimerState for Scaled{
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,Debug)]
|
||||
pub struct TimerFixed<T:TimerState,P:PauseState>{
|
||||
state:T,
|
||||
_paused:P,
|
||||
|
Loading…
Reference in New Issue
Block a user