From f940d8c8fa087554583158d50df071af89c516db Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Sat, 19 Nov 2022 20:32:07 +0100 Subject: [PATCH] chore: upgrade dependencies (#9) Co-authored-by: Markus Siemens --- Cargo.toml.orig | 8 ++++---- src/errors.rs | 6 +++--- src/reader.rs | 2 +- src/utils.rs | 5 ++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 9afddd0..e302436 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -14,15 +14,15 @@ categories = ["parser-implementations"] backtrace = [] [dependencies] -bytes = "0.5" +bytes = "1.2.0" encoding_rs = "0.8.31" enum-primitive-derive = "0.2.2" -itertools = "0.9.0" +itertools = "0.10.3" num-traits = "0.2" paste = "1.0" thiserror = "1.0" -uuid = "0.8" -widestring = "0.4.3" +uuid = "1.1.2" +widestring = "1.0.2" [dev-dependencies] insta = "1.21.1" diff --git a/src/errors.rs b/src/errors.rs index 91477b3..50079a3 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -51,8 +51,8 @@ impl From for Error { } } -impl From> for Error { - fn from(err: widestring::MissingNulError) -> Self { +impl From for Error { + fn from(err: widestring::error::MissingNulTerminator) -> Self { ErrorKind::from(err).into() } } @@ -128,6 +128,6 @@ pub enum ErrorKind { #[error("UTF-16 string is missing null terminator: {err}")] Utf16MissingNull { #[from] - err: widestring::MissingNulError, + err: widestring::error::MissingNulTerminator, }, } diff --git a/src/reader.rs b/src/reader.rs index 64730d0..318c280 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -40,7 +40,7 @@ impl<'a> Reader<'a> { } pub(crate) fn bytes(&self) -> &[u8] { - self.0.bytes() + self.0.chunk() } pub(crate) fn remaining(&self) -> usize { diff --git a/src/utils.rs b/src/utils.rs index fd77181..074ff50 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -12,8 +12,7 @@ impl Utf16ToString for &[u8] { .map(|v| u16::from_le_bytes([v[0], v[1]])) .collect(); - let value = U16CString::from_vec_with_nul(data)?; - - Ok(value.to_string()?) + let value = U16CString::from_vec_truncate(data); + Ok(value.to_string().unwrap()) } }