mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-12 18:05:48 +00:00
Update to parity-scale-codec (#3232)
* WIP: update codec * WIP * compiling * WIP * rename parity-scale-codec to codec * WIP * fix * remove old comments * use published crates * fix expected error msg * bump version * fmt and fix * remove old comment * fix wrong decoding impl * implement encode like for structures * undo removal of old pending changes * trailingzeroinput * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * update codec * fmt * version is 1.0.0 * show more error * fmt
This commit is contained in:
committed by
Bastian Köcher
parent
a0d442333f
commit
4ed67e03a4
@@ -35,7 +35,6 @@ mod pruning;
|
||||
|
||||
use std::fmt;
|
||||
use parking_lot::RwLock;
|
||||
use parity_codec as codec;
|
||||
use codec::Codec;
|
||||
use std::collections::{VecDeque, HashMap, hash_map::Entry};
|
||||
use noncanonical::NonCanonicalOverlay;
|
||||
@@ -71,7 +70,7 @@ pub enum Error<E: fmt::Debug> {
|
||||
/// Database backend error.
|
||||
Db(E),
|
||||
/// `Codec` decoding error.
|
||||
Decoding,
|
||||
Decoding(codec::Error),
|
||||
/// Trying to canonicalize invalid block.
|
||||
InvalidBlock,
|
||||
/// Trying to insert block with invalid number.
|
||||
@@ -82,11 +81,17 @@ pub enum Error<E: fmt::Debug> {
|
||||
DiscardingPinned,
|
||||
}
|
||||
|
||||
impl<E: fmt::Debug> From<codec::Error> for Error<E> {
|
||||
fn from(x: codec::Error) -> Self {
|
||||
Error::Decoding(x)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: fmt::Debug> fmt::Debug for Error<E> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Error::Db(e) => e.fmt(f),
|
||||
Error::Decoding => write!(f, "Error decoding slicable value"),
|
||||
Error::Decoding(e) => write!(f, "Error decoding slicable value: {}", e.what()),
|
||||
Error::InvalidBlock => write!(f, "Trying to canonicalize invalid block"),
|
||||
Error::InvalidBlockNumber => write!(f, "Trying to insert block with invalid number"),
|
||||
Error::InvalidParent => write!(f, "Trying to insert block with unknown parent"),
|
||||
|
||||
Reference in New Issue
Block a user