more functions
This commit is contained in:
parent
fed810334b
commit
0dd41ae2f1
27
src/timer.rs
27
src/timer.rs
@ -243,6 +243,33 @@ impl<T:TimerState> Timer<T>{
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
pub fn is_paused(&self)->bool{
|
||||
match self{
|
||||
Self::Paused(_)=>true,
|
||||
Self::Unpaused(_)=>false,
|
||||
}
|
||||
}
|
||||
pub fn set_paused(&mut self,time:Time,paused:bool)->Result<(),Error>{
|
||||
match paused{
|
||||
true=>self.pause(time),
|
||||
false=>self.unpause(time),
|
||||
}
|
||||
}
|
||||
}
|
||||
//scaled timer methods are generic across PauseState
|
||||
impl Timer<Scaled>{
|
||||
pub const fn get_scale(&self)->Ratio64{
|
||||
match self{
|
||||
Self::Paused(timer)=>timer.get_scale(),
|
||||
Self::Unpaused(timer)=>timer.get_scale(),
|
||||
}
|
||||
}
|
||||
pub fn set_scale(&mut self,time:Time,new_scale:Ratio64){
|
||||
match self{
|
||||
Self::Paused(timer)=>timer.set_scale(time,new_scale),
|
||||
Self::Unpaused(timer)=>timer.set_scale(time,new_scale),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Loading…
Reference in New Issue
Block a user