From b8ad94cd5061445a45d0790eee36014d34ad6817 Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sat, 22 Feb 2025 22:59:01 +0100 Subject: replace deprecated failure crate with thiserror this changes the public API in that all our methods now return a proper ProtocolError crate. Needed change anyways to properly deal with all our errors in the long run. Will still need to do a pass through the crate to remove all existing unwraps where it makes sense. --- src/primitive/variantlist.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/primitive/variantlist.rs') diff --git a/src/primitive/variantlist.rs b/src/primitive/variantlist.rs index d3518e6..58286e3 100644 --- a/src/primitive/variantlist.rs +++ b/src/primitive/variantlist.rs @@ -1,9 +1,8 @@ use std::vec::Vec; -use failure::Error; - use log::trace; +use crate::error::ProtocolError; use crate::{deserialize::*, serialize::*}; use crate::primitive::Variant; @@ -14,7 +13,7 @@ use crate::primitive::Variant; pub type VariantList = Vec; impl Serialize for VariantList { - fn serialize(&self) -> Result, Error> { + fn serialize(&self) -> Result, ProtocolError> { let len: i32 = self.len().try_into()?; let mut res: Vec = Vec::new(); @@ -28,7 +27,7 @@ impl Serialize for VariantList { } impl Deserialize for VariantList { - fn parse(b: &[u8]) -> Result<(usize, Self), Error> { + fn parse(b: &[u8]) -> Result<(usize, Self), ProtocolError> { let (_, len) = i32::parse(&b[0..4])?; trace!(target: "primitive::VariantList", "Parsing VariantList with {:?} elements", len); -- cgit v1.2.3