change function name to reflect what it does

This commit is contained in:
Quaternions 2024-07-31 18:28:39 -07:00
parent 42b1ae98f7
commit d58af1f2b2

View File

@ -131,7 +131,7 @@ impl<P:PauseState> TimerFixed<Scaled,P>{
//pause and unpause is generic across TimerState //pause and unpause is generic across TimerState
impl<T:TimerState> TimerFixed<T,Paused>{ impl<T:TimerState> TimerFixed<T,Paused>{
pub fn unpause(self,time:Time)->TimerFixed<T,Unpaused>{ pub fn into_unpaused(self,time:Time)->TimerFixed<T,Unpaused>{
let new_time=self.time(time); let new_time=self.time(time);
let mut timer=TimerFixed{ let mut timer=TimerFixed{
state:self.state, state:self.state,
@ -142,7 +142,7 @@ impl<T:TimerState> TimerFixed<T,Paused>{
} }
} }
impl<T:TimerState> TimerFixed<T,Unpaused>{ impl<T:TimerState> TimerFixed<T,Unpaused>{
pub fn pause(self,time:Time)->TimerFixed<T,Paused>{ pub fn into_paused(self,time:Time)->TimerFixed<T,Paused>{
let new_time=self.time(time); let new_time=self.time(time);
let mut timer=TimerFixed{ let mut timer=TimerFixed{
state:self.state, state:self.state,
@ -202,12 +202,12 @@ impl<T:TimerState> Timer<T>{
pub fn pause(self,time:Time)->Result<TimerFixed<T,Paused>,Error>{ pub fn pause(self,time:Time)->Result<TimerFixed<T,Paused>,Error>{
match self{ match self{
Self::Paused(_)=>Err(Error::AlreadyPaused), Self::Paused(_)=>Err(Error::AlreadyPaused),
Self::Unpaused(timer)=>Ok(timer.pause(time)), Self::Unpaused(timer)=>Ok(timer.into_paused(time)),
} }
} }
pub fn unpause(self,time:Time)->Result<TimerFixed<T,Unpaused>,Error>{ pub fn unpause(self,time:Time)->Result<TimerFixed<T,Unpaused>,Error>{
match self{ match self{
Self::Paused(timer)=>Ok(timer.unpause(time)), Self::Paused(timer)=>Ok(timer.into_unpaused(time)),
Self::Unpaused(_)=>Err(Error::AlreadyUnpaused), Self::Unpaused(_)=>Err(Error::AlreadyUnpaused),
} }
} }