rlp_decoder/traits.rs
1// Copyright 2020 Parity Technologies
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9//! Common RLP traits
10
11use crate::{
12 error::DecoderError,
13 rlpin::Rlp,
14};
15
16/// RLP decodable trait
17pub trait Decodable: Sized {
18 /// Decode a value from RLP bytes
19 fn decode(rlp: &Rlp) -> Result<Self, DecoderError>;
20}
21