pub enum Error {
IoError(Error),
Serde(String),
InvalidTypeId(u8),
HeterogeneousList,
NoRootCompound,
InvalidUtf8,
IncompleteNbtValue,
TagMismatch(u8, u8),
UnexpectedField(String),
NonBooleanByte(i8),
UnrepresentableType(&'static str),
NonStringMapKey,
}
Expand description
Errors that may be encountered when constructing, parsing, or encoding
NbtValue
and NbtBlob
objects.
Error
s can be seamlessly converted to more general io::Error
objects
using std::convert::From::from()
.
Variants§
IoError(Error)
Wraps errors emitted by methods during I/O operations.
Serde(String)
Wraps errors emitted during (de-)serialization with serde
.
InvalidTypeId(u8)
An error for when an unknown type ID is encountered in decoding NBT binary representations. Includes the ID in question.
HeterogeneousList
An error emitted when trying to create NbtBlob
s with incorrect lists.
NoRootCompound
An error for when NBT binary representations do not begin with an
NbtValue::Compound
.
InvalidUtf8
An error for when NBT binary representations contain invalid UTF-8 strings.
IncompleteNbtValue
An error for when NBT binary representations are missing end tags, contain fewer bytes than advertised, or are otherwise incomplete.
TagMismatch(u8, u8)
An error encountered when parsing NBT binary representations, where deserialization encounters a different tag than expected.
UnexpectedField(String)
An error encountered when parsing NBT binary representations, where deserialization encounters a field name it is not expecting.
NonBooleanByte(i8)
An error encountered when deserializing a boolean from an invalid byte.
UnrepresentableType(&'static str)
An error encountered when serializing a Rust type with no meaningful NBT representation.
NonStringMapKey
An error encountered when trying to (de)serialize a map key with a non-string type.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl Error for Error
impl Error for Error
Source§fn custom<T: Display>(msg: T) -> Error
fn custom<T: Display>(msg: T) -> Error
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize
receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize
receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize
enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize
struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize
struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize
struct type received more than one of the
same field.