mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
23 lines
822 B
Rust
23 lines
822 B
Rust
use core::fmt;
|
|
use std::fmt::Formatter;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum GDError {
|
|
PacketOverflow(String),
|
|
PacketUnderflow(String),
|
|
PacketBad(String),
|
|
PacketSend(String),
|
|
PacketReceive(String)
|
|
}
|
|
|
|
impl fmt::Display for GDError {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
GDError::PacketOverflow(details) => write!(f, "Packet overflow: {details}"),
|
|
GDError::PacketUnderflow(details) => write!(f, "Packet underflow: {details}"),
|
|
GDError::PacketBad(details) => write!(f, "Packet bad: {details}"),
|
|
GDError::PacketSend(details) => write!(f, "Couldn't send a packet: {details}"),
|
|
GDError::PacketReceive(details) => write!(f, "Couldn't receive a packet: {details}")
|
|
}
|
|
}
|
|
}
|