Trait strict_encoding::StrictDecode [−][src]
pub trait StrictDecode: Sized { fn strict_decode<D: Read>(d: D) -> Result<Self, Error>; fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error> { ... } }
Expand description
Binary decoding according to the strict rules that usually apply to consensus-critical data structures. May be used for network communications. MUST NOT be used for commitment verification: even if the commit procedure uses StrictEncode, the actual commit verification MUST be done with [CommitVerify], [TryCommitVerify] and [EmbedCommitVerify] traits, which, instead of deserializing (nonce operation for commitments) repeat the commitment procedure for the revealed message and verify it against the provided commitment.
Required methods
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
Expand description
Decode with the given [std::io::Reader] instance; must either construct an instance or return implementation-specific error type.
Provided methods
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
[src]
Expand description
Tries to deserialize byte array into the current type using
[strict_decode()
]
Implementations on Foreign Types
impl StrictDecode for FlagVec
[src]
impl StrictDecode for FlagVec
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u256
[src]
impl StrictDecode for u256
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u512
[src]
impl StrictDecode for u512
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u1024
[src]
impl StrictDecode for u1024
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for Option<T> where
T: StrictDecode,
[src]
impl<T> StrictDecode for Option<T> where
T: StrictDecode,
[src]In terms of strict encoding, Option
(optional values) are
represented by a significator byte, which MUST be either 0
(for no
value present) or 1
, followed by the value strict encoding.
For decoding an attempt to read Option
from a encoded non-0
or non-1 length Vec will result in Error::WrongOptionalEncoding
.
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for Vec<T> where
T: StrictDecode,
[src]
impl<T> StrictDecode for Vec<T> where
T: StrictDecode,
[src]In terms of strict encoding, Vec
is stored in form of
usize-encoded length (see StrictEncode
implementation for usize
type for encoding platform-independent constant-length
encoding rules) followed by a consequently-encoded vec items,
according to their type.
An attempt to encode Vec
with more items than can fit in usize
encoding rules will result in Error::ExceedMaxItems
.
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for HashSet<T> where
T: StrictDecode + Eq + Ord + Hash + Debug,
[src]
impl<T> StrictDecode for HashSet<T> where
T: StrictDecode + Eq + Ord + Hash + Debug,
[src]Strict decoding of a unique value collection represented by a rust
HashSet
type is performed alike Vec
decoding with the only
exception: if the repeated value met a Error::RepeatedValue is
returned.
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for BTreeSet<T> where
T: StrictDecode + Eq + Ord + Debug,
[src]
impl<T> StrictDecode for BTreeSet<T> where
T: StrictDecode + Eq + Ord + Debug,
[src]Strict decoding of a unique value collection represented by a rust
BTreeSet
type is performed alike Vec
decoding with the only
exception: if the repeated value met a Error::RepeatedValue is
returned.
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for HashMap<usize, T> where
T: StrictDecode + Clone,
[src]
impl<T> StrictDecode for HashMap<usize, T> where
T: StrictDecode + Clone,
[src]LNP/BP library uses HashMap<usize, T: StrictEncode>
s to encode
ordered lists, where the position of the list item must be fixed, since
the item is referenced from elsewhere by its index. Thus, the library
does not supports and recommends not to support strict encoding
of any other HashMap
variants.
Strict encoding of the HashMap<usize, T>
type is performed by
converting into a fixed-order Vec<T>
and serializing it according to
the Vec
strict encoding rules. This operation is internally
performed via conversion into BTreeMap<usize, T: StrictEncode>
.
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<K, V> StrictDecode for BTreeMap<K, V> where
K: StrictDecode + Ord + Clone,
V: StrictDecode + Clone,
[src]
impl<K, V> StrictDecode for BTreeMap<K, V> where
K: StrictDecode + Ord + Clone,
V: StrictDecode + Clone,
[src]LNP/BP library uses BTreeMap<usize, T: StrictEncode>
s to encode
ordered lists, where the position of the list item must be fixed, since
the item is referenced from elsewhere by its index. Thus, the library
does not supports and recommends not to support strict encoding
of any other BTreeMap
variants.
Strict encoding of the BTreeMap<usize, T>
type is performed
by converting into a fixed-order Vec<T>
and serializing it according
to the Vec
strict encoding rules.
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<K, V> StrictDecode for (K, V) where
K: StrictDecode + Clone,
V: StrictDecode + Clone,
[src]
impl<K, V> StrictDecode for (K, V) where
K: StrictDecode + Clone,
V: StrictDecode + Clone,
[src]Two-component tuples are decoded as they were fields in the parent data structure
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for [u8; 16]
[src]
impl StrictDecode for [u8; 16]
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for [u8; 20]
[src]
impl StrictDecode for [u8; 20]
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for [u8; 32]
[src]
impl StrictDecode for [u8; 32]
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for [u8; 64]
[src]
impl StrictDecode for [u8; 64]
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for Rc<T> where
T: StrictDecode,
[src]
impl<T> StrictDecode for Rc<T> where
T: StrictDecode,
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for RefCell<T> where
T: StrictDecode,
[src]
impl<T> StrictDecode for RefCell<T> where
T: StrictDecode,
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for Arc<T> where
T: StrictDecode,
[src]
impl<T> StrictDecode for Arc<T> where
T: StrictDecode,
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for String
[src]
impl StrictDecode for String
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for bool
[src]
impl StrictDecode for bool
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u8
[src]
impl StrictDecode for u8
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for i8
[src]
impl StrictDecode for i8
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u16
[src]
impl StrictDecode for u16
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for i16
[src]
impl StrictDecode for i16
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u32
[src]
impl StrictDecode for u32
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for i32
[src]
impl StrictDecode for i32
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u64
[src]
impl StrictDecode for u64
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for i64
[src]
impl StrictDecode for i64
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for u128
[src]
impl StrictDecode for u128
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for i128
[src]
impl StrictDecode for i128
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for usize
[src]
impl StrictDecode for usize
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for f32
[src]
impl StrictDecode for f32
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for f64
[src]
impl StrictDecode for f64
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for Duration
[src]
impl StrictDecode for Duration
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for NaiveDateTime
[src]
impl StrictDecode for NaiveDateTime
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for DateTime<Utc>
[src]
impl StrictDecode for DateTime<Utc>
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<W> StrictDecode for Holder<W, Wrapped> where
W: Wrapper,
W::Inner: StrictDecode,
[src]
impl<W> StrictDecode for Holder<W, Wrapped> where
W: Wrapper,
W::Inner: StrictDecode,
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<H> StrictDecode for Holder<H, HashFixedBytes> where
H: Hash,
[src]
impl<H> StrictDecode for Holder<H, HashFixedBytes> where
H: Hash,
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<A> StrictDecode for Holder<A, UsingUniformAddr> where
A: Uniform,
[src]
impl<A> StrictDecode for Holder<A, UsingUniformAddr> where
A: Uniform,
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
Implementors
impl StrictDecode for AddrFormat
[src]
impl StrictDecode for AddrFormat
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for Transport
[src]
impl StrictDecode for Transport
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for RawAddr
[src]
impl StrictDecode for RawAddr
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl StrictDecode for RawUniformAddr
[src]
impl StrictDecode for RawUniformAddr
[src]fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl<T> StrictDecode for T where
T: Strategy,
Holder<T, <T as Strategy>::Strategy>: StrictDecode,
[src]
impl<T> StrictDecode for T where
T: Strategy,
Holder<T, <T as Strategy>::Strategy>: StrictDecode,
[src]