1
0
Fork 0
mirror of https://github.com/azalea-rs/simdnbt.git synced 2025-08-02 15:36:03 +00:00

impl Debug for NonRootError

This commit is contained in:
mat 2024-12-23 01:46:19 +00:00
parent 27766aa5fd
commit b2ffaac105

View file

@ -1,3 +1,5 @@
use std::fmt::Debug;
use thiserror::Error;
use crate::common::MAX_DEPTH;
@ -38,6 +40,7 @@ impl From<NonRootError> for Error {
}
}
}
impl NonRootError {
#[inline]
pub fn unexpected_eof() -> Self {
@ -62,6 +65,16 @@ impl From<UnexpectedEofError> for NonRootError {
NonRootError::unexpected_eof()
}
}
impl Debug for NonRootError {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.value {
0 => write!(f, "UnexpectedEofError"),
1 => write!(f, "MaxDepthExceededError"),
_ => write!(f, "UnknownTagId({})", self.value.wrapping_add(1)),
}
}
}
#[derive(Error, Debug)]
pub enum DeserializeError {