aboutsummaryrefslogtreecommitdiff
path: root/azalea-nbt/src/error.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-10-07 20:12:36 -0500
committerGitHub <noreply@github.com>2022-10-07 20:12:36 -0500
commitbc3aa9467ae1e2d0ea1727093af9b0af14965e69 (patch)
tree8db3b735daed484507129eb0683db88ddec14210 /azalea-nbt/src/error.rs
parent695efef66fdf1e08f0cb6d8783c085875100fa2d (diff)
downloadazalea-drasl-bc3aa9467ae1e2d0ea1727093af9b0af14965e69.tar.xz
Replace impl Read with Cursor<&[u8]> (#26)
* Start getting rid of Cursor * try to make the tests pass and fail * make the tests pass * remove unused uses * fix clippy warnings * fix potential OOM exploits * fix OOM in az-nbt * fix nbt benchmark * fix a test * start replacing it with Cursor<Vec<u8>> * wip * fix all the issues * fix all tests * fix nbt benchmark * fix warnings
Diffstat (limited to 'azalea-nbt/src/error.rs')
-rwxr-xr-xazalea-nbt/src/error.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/azalea-nbt/src/error.rs b/azalea-nbt/src/error.rs
index ef4a9e9f..308c74c8 100755
--- a/azalea-nbt/src/error.rs
+++ b/azalea-nbt/src/error.rs
@@ -3,7 +3,8 @@ pub enum Error {
InvalidTagType(u8),
InvalidTag,
WriteError(std::io::Error),
- Utf8Error(std::string::FromUtf8Error),
+ Utf8Error(std::str::Utf8Error),
+ UnexpectedEof,
}
impl std::fmt::Display for Error {
@@ -13,6 +14,7 @@ impl std::fmt::Display for Error {
Error::InvalidTag => write!(f, "Invalid tag"),
Error::WriteError(e) => write!(f, "Write error: {}", e),
Error::Utf8Error(e) => write!(f, "Utf8 error: {}", e),
+ Error::UnexpectedEof => write!(f, "Unexpected EOF"),
}
}
}
@@ -22,8 +24,8 @@ impl From<std::io::Error> for Error {
Error::WriteError(e)
}
}
-impl From<std::string::FromUtf8Error> for Error {
- fn from(e: std::string::FromUtf8Error) -> Self {
+impl From<std::str::Utf8Error> for Error {
+ fn from(e: std::str::Utf8Error) -> Self {
Error::Utf8Error(e)
}
}