use std::error::Error;
use std::fmt::{
Display,
Formatter,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MockTimeError {
ActiveWaiters,
MismatchedTimeline {
expected: u64,
actual: u64,
},
}
impl Display for MockTimeError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Self::ActiveWaiters => write!(f, "mock timeline has active waiters"),
Self::MismatchedTimeline { expected, actual } => write!(
f,
"mock instant belongs to timeline {actual}, but timeline {expected} was expected",
),
}
}
}
impl Error for MockTimeError {}