Enum TimerError
pub enum TimerError {
ZeroInterval,
ZeroCatchUpLimit,
ElapsedOverflow,
}Expand description
A rejected timer configuration or advance. Errors never change timer state.
use ferravex_engine::time::{SimulationTimer, TimerError};
use std::time::Duration;
assert_eq!(SimulationTimer::once(Duration::ZERO).unwrap_err(), TimerError::ZeroInterval);
assert_eq!(
SimulationTimer::repeating(Duration::from_secs(1), 0).unwrap_err(),
TimerError::ZeroCatchUpLimit,
);
let mut timer = SimulationTimer::repeating(Duration::from_secs(1), 4)?;
timer.advance(Duration::from_nanos(1))?;
assert_eq!(timer.advance(Duration::MAX), Err(TimerError::ElapsedOverflow));
assert_eq!(timer.elapsed(), Duration::from_nanos(1));Variants§
ZeroInterval
An interval must contain at least one nanosecond.
ZeroCatchUpLimit
A repeating timer must permit at least one reported expiration per call.
ElapsedOverflow
Adding a delta to the repeating timer’s remainder exceeded Duration::MAX.
Trait Implementations§
§impl Clone for TimerError
impl Clone for TimerError
§fn clone(&self) -> TimerError
fn clone(&self) -> TimerError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for TimerError
impl Debug for TimerError
§impl Display for TimerError
impl Display for TimerError
§impl Error for TimerError
impl Error for TimerError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
§impl PartialEq for TimerError
impl PartialEq for TimerError
impl Copy for TimerError
impl Eq for TimerError
impl StructuralPartialEq for TimerError
Auto Trait Implementations§
impl Freeze for TimerError
impl RefUnwindSafe for TimerError
impl Send for TimerError
impl Sync for TimerError
impl Unpin for TimerError
impl UnwindSafe for TimerError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more