mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-10-27 02:03:18 -06:00
1 parent
82135e07a7
commit
2f26b40e30
21 files changed
+436
-80
No files matched your search
@@ -0,0 +1,27 @@
|
||||
use core::{
|
||||
error,
|
||||
fmt::{self, Display, Formatter},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Error {
|
||||
description: &'static str,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
pub const fn new(description: &'static str) -> Error {
|
||||
Error { description }
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||
write!(formatter, "{}", self.description)
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
self.description
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user