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/bufferinfo.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/primitive/bufferinfo.rs') diff --git a/src/primitive/bufferinfo.rs b/src/primitive/bufferinfo.rs index 97d9408..a87c418 100644 --- a/src/primitive/bufferinfo.rs +++ b/src/primitive/bufferinfo.rs @@ -1,8 +1,6 @@ use std::vec::Vec; -use failure::Error; - -use crate::{deserialize::*, serialize::*}; +use crate::{deserialize::*, error::ProtocolError, serialize::*}; /// The BufferInfo struct represents a BufferInfo as received in IRC /// @@ -20,7 +18,7 @@ pub struct BufferInfo { } impl Serialize for BufferInfo { - fn serialize(&self) -> Result, Error> { + fn serialize(&self) -> Result, ProtocolError> { let mut values: Vec = Vec::new(); values.append(&mut i32::serialize(&self.id)?); @@ -34,7 +32,7 @@ impl Serialize for BufferInfo { } impl Deserialize for BufferInfo { - fn parse(b: &[u8]) -> Result<(usize, Self), Error> { + fn parse(b: &[u8]) -> Result<(usize, Self), ProtocolError> { let (_, id) = i32::parse(&b[0..4])?; let (_, network_id) = i32::parse(&b[4..8])?; let (_, buffer_type) = i16::parse(&b[8..10])?; -- cgit v1.2.3