This commit is contained in:
Yota Toyama
2023-05-20 19:35:25 -07:00
committed by GitHub
parent ca51b73cf5
commit 8f73f3d63a
2 changed files with 16 additions and 16 deletions
+8 -3
View File
@@ -1,3 +1,8 @@
use std::{
error,
fmt::{self, Display, Formatter},
};
#[derive(Debug)]
pub struct Error {
description: &'static str,
@@ -9,13 +14,13 @@ impl Error {
}
}
impl std::fmt::Display for Error {
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
impl Display for Error {
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
write!(formatter, "{}", self.description)
}
}
impl std::error::Error for Error {
impl error::Error for Error {
fn description(&self) -> &str {
self.description
}