use crate::ReadError;
use core::fmt;
#[non_exhaustive]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum Error {
Malformed,
MissingResource,
InvalidOperation,
LimitExceeded,
InsufficientMemory,
}
impl From<ReadError> for Error {
fn from(_: ReadError) -> Self {
Self::Malformed
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::Malformed => "font data was malformed",
Self::MissingResource => "a required part of the font was missing",
Self::InvalidOperation => "a program in the font did something invalid",
Self::LimitExceeded => "the font exceeded a processing limit",
Self::InsufficientMemory => "the supplied memory was too small",
})
}
}
impl core::error::Error for Error {}