mirror of
https://github.com/azalea-rs/simdnbt.git
synced 2025-08-02 07:26:04 +00:00
impl Debug for NonRootError
This commit is contained in:
parent
27766aa5fd
commit
b2ffaac105
1 changed files with 13 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue