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/variantmap.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/primitive/variantmap.rs') diff --git a/src/primitive/variantmap.rs b/src/primitive/variantmap.rs index 1eeb006..3cb30cc 100644 --- a/src/primitive/variantmap.rs +++ b/src/primitive/variantmap.rs @@ -1,10 +1,9 @@ use std::collections::HashMap; use std::vec::Vec; -use failure::Error; - use log::trace; +use crate::error::ProtocolError; use crate::{deserialize::*, serialize::*}; use crate::primitive::Variant; @@ -16,7 +15,7 @@ use crate::util; pub type VariantMap = HashMap; impl Serialize for VariantMap { - fn serialize<'a>(&'a self) -> Result, Error> { + fn serialize<'a>(&'a self) -> Result, ProtocolError> { let mut res: Vec = Vec::new(); for (k, v) in self { @@ -32,7 +31,7 @@ impl Serialize for VariantMap { } impl Deserialize for VariantMap { - 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::VariantMap", "Parsing VariantMap with {:?} elements", len); -- cgit v1.2.3