From bc3aa9467ae1e2d0ea1727093af9b0af14965e69 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Fri, 7 Oct 2022 20:12:36 -0500 Subject: 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> * wip * fix all the issues * fix all tests * fix nbt benchmark * fix warnings --- azalea-nbt/src/error.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'azalea-nbt/src/error.rs') 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 for Error { Error::WriteError(e) } } -impl From for Error { - fn from(e: std::string::FromUtf8Error) -> Self { +impl From for Error { + fn from(e: std::str::Utf8Error) -> Self { Error::Utf8Error(e) } } -- cgit v1.2.3