mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
Implement std::error::Error for GDError
This commit is contained in:
parent
e72d7bdf8b
commit
3928d3a818
1 changed files with 11 additions and 1 deletions
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
//! The library's possible errors.
|
||||
use std::fmt;
|
||||
use std::{fmt::Formatter, error::Error};
|
||||
|
||||
/// Result of Type and GDError.
|
||||
pub type GDResult<T> = Result<T, GDError>;
|
||||
|
||||
/// GameDigError.
|
||||
/// GameDig Error.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum GDError {
|
||||
/// The received packet was bigger than the buffer size.
|
||||
|
|
@ -38,3 +40,11 @@ pub enum GDError {
|
|||
/// Couldn't parse a value.
|
||||
TypeParse,
|
||||
}
|
||||
|
||||
impl Error for GDError {}
|
||||
|
||||
impl fmt::Display for GDError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue