TimerFixed is Copy

This commit is contained in:
Quaternions 2024-07-31 15:56:30 -07:00
parent 7736a1f8a2
commit 1751356e3c

View File

@ -1,9 +1,11 @@
use crate::integer::{Time,Ratio64}; use crate::integer::{Time,Ratio64};
#[derive(Clone,Copy,Debug)]
pub struct Paused; pub struct Paused;
#[derive(Clone,Copy,Debug)]
pub struct Unpaused; pub struct Unpaused;
pub trait PauseState{ pub trait PauseState:Copy{
const IS_PAUSED:bool; const IS_PAUSED:bool;
fn new()->Self; fn new()->Self;
} }
@ -20,6 +22,7 @@ impl PauseState for Unpaused{
} }
} }
#[derive(Clone,Copy,Debug)]
pub struct Realtime{ pub struct Realtime{
offset:Time, offset:Time,
} }
@ -28,6 +31,8 @@ impl Realtime{
Self{offset:Time::ZERO} Self{offset:Time::ZERO}
} }
} }
#[derive(Clone,Copy,Debug)]
pub struct Scaled{ pub struct Scaled{
scale:Ratio64, scale:Ratio64,
offset:Time, offset:Time,
@ -52,7 +57,7 @@ impl Scaled{
} }
} }
pub trait TimerState{ pub trait TimerState:Copy{
fn get_time(&self,time:Time)->Time; fn get_time(&self,time:Time)->Time;
fn set_time(&mut self,time:Time,new_time:Time); fn set_time(&mut self,time:Time,new_time:Time);
fn get_offset(&self)->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>{ pub struct TimerFixed<T:TimerState,P:PauseState>{
state:T, state:T,
_paused:P, _paused:P,