From fbfaad1da0740e84c58e75d0d6363a573ce7c6ee Mon Sep 17 00:00:00 2001 From: SergeyY <43989533+yaroslavser@users.noreply.github.com> Date: Wed, 19 Jun 2024 15:52:21 +0200 Subject: [PATCH] Use modern crates anyhow and thiserror instead of failure (#52) --- CHANGELOG.md | 4 ++++ Cargo.toml | 8 +++----- src/scheme/mod.rs | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a440a9..6feb666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. ## +## Version 1.1.0 + +- Use modern crates anyhow and thiserror instead of failure + ## Version 1.0.31 - Supported merge of block and types repos diff --git a/Cargo.toml b/Cargo.toml index 20443a5..3f7cdc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,11 +5,9 @@ license = 'Apache-2.0' name = 'ever-struct' repository = 'https://github.com/everx-labs/ever-struct' rust-version = '1.65' -version = '1.0.36' +version = '1.1.0' [dependencies] -anyhow = '1.0.70' -failure = '0.1.0' -hex-literal = '0.3.4' +anyhow = '1.0' +thiserror = '1.0' ever_block = { git = 'https://github.com/everx-labs/ever-block.git', tag = '1.10.4' } - diff --git a/src/scheme/mod.rs b/src/scheme/mod.rs index 45a0c1e..f346c59 100644 --- a/src/scheme/mod.rs +++ b/src/scheme/mod.rs @@ -18,9 +18,9 @@ use ever_block::{ fail, BuilderData, Cell, Deserializable, IBitstring, Result, Serializable, SliceData, }; -#[derive(Debug, failure::Fail)] +#[derive(Debug, thiserror::Error)] pub enum DeserializationError { - #[fail(display = "unexpected tlb tag")] + #[error("unexpected tlb tag")] UnexpectedTLBTag, } @@ -124,7 +124,7 @@ impl Deserializable for TVC { fn read_from(&mut self, slice: &mut SliceData) -> Result<()> { let tag = slice.get_next_u32()?; if tag != Self::TVC_TAG { - return Err(DeserializationError::UnexpectedTLBTag.into()); + fail!(DeserializationError::UnexpectedTLBTag); } if slice.get_next_bit()? {