mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +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.
|
//! The library's possible errors.
|
||||||
|
use std::fmt;
|
||||||
|
use std::{fmt::Formatter, error::Error};
|
||||||
|
|
||||||
/// Result of Type and GDError.
|
/// Result of Type and GDError.
|
||||||
pub type GDResult<T> = Result<T, GDError>;
|
pub type GDResult<T> = Result<T, GDError>;
|
||||||
|
|
||||||
/// GameDigError.
|
/// GameDig Error.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum GDError {
|
pub enum GDError {
|
||||||
/// The received packet was bigger than the buffer size.
|
/// The received packet was bigger than the buffer size.
|
||||||
|
|
@ -38,3 +40,11 @@ pub enum GDError {
|
||||||
/// Couldn't parse a value.
|
/// Couldn't parse a value.
|
||||||
TypeParse,
|
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