use core::fmt;
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
NotImplemented,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NotImplemented => f.write_str("emdb: operation not yet implemented"),
}
}
}
impl std::error::Error for Error {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_not_implemented_display_is_stable() {
let msg = format!("{}", Error::NotImplemented);
assert!(msg.contains("not yet implemented"));
}
#[test]
fn test_error_implements_std_error() {
fn assert_error<E: std::error::Error>() {}
assert_error::<Error>();
}
}