use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CFError {
operation: &'static str,
}
impl CFError {
#[must_use]
pub const fn new(operation: &'static str) -> Self {
Self { operation }
}
#[must_use]
pub const fn operation(&self) -> &'static str {
self.operation
}
}
impl fmt::Display for CFError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{} returned a null Core Foundation/Core Graphics pointer",
self.operation
)
}
}
impl std::error::Error for CFError {}