use std::fmt;
use std::error::Error;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TryFromIntError;
impl fmt::Display for TryFromIntError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"out of range integral type conversion attempted".fmt(f)
}
}
impl Error for TryFromIntError {
fn description(&self) -> &str {
"out of range integral type conversion attempted"
}
}
impl From<()> for TryFromIntError {
fn from(_: ()) ->TryFromIntError {
TryFromIntError
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TryFromFloatError;
impl fmt::Display for TryFromFloatError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"out of range floating point conversion attempted".fmt(f)
}
}
impl Error for TryFromFloatError {
fn description(&self) -> &str {
"out of range floating point conversion attempted"
}
}
impl From<()> for TryFromFloatError {
fn from(_: ()) ->TryFromFloatError {
TryFromFloatError
}
}