Trait lightning_encoding::LightningDecode
source · pub trait LightningDecodewhere
Self: Sized,{
// Required method
fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>;
// Provided method
fn lightning_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error> { ... }
}
Expand description
Lightning-network specific encoding as defined in BOLT-1, 2, 3…
Required Methods§
sourcefn lightning_decode<D: Read>(d: D) -> Result<Self, Error>
fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given std::io::Read
instance; must either
construct an instance or return implementation-specific error type.
Provided Methods§
sourcefn lightning_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn lightning_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
LightningDecode::lightning_decode
function.
Implementations on Foreign Types§
source§impl LightningDecode for Script
impl LightningDecode for Script
source§impl LightningDecode for Box<[u8]>
impl LightningDecode for Box<[u8]>
source§impl LightningDecode for String
impl LightningDecode for String
source§impl<T> LightningDecode for Option<T>where
T: LightningDecode,
impl<T> LightningDecode for Option<T>where
T: LightningDecode,
source§impl<T> LightningDecode for Vec<T>where
T: LightningDecode,
impl<T> LightningDecode for Vec<T>where
T: LightningDecode,
source§impl<T> LightningDecode for HashSet<T>where
T: LightningDecode + Eq + Hash,
impl<T> LightningDecode for HashSet<T>where
T: LightningDecode + Eq + Hash,
source§impl<K, V> LightningDecode for HashMap<K, V>where
K: LightningDecode + Eq + Hash,
V: LightningDecode,
impl<K, V> LightningDecode for HashMap<K, V>where
K: LightningDecode + Eq + Hash,
V: LightningDecode,
source§impl<T> LightningDecode for BTreeSet<T>where
T: LightningDecode + Ord,
impl<T> LightningDecode for BTreeSet<T>where
T: LightningDecode + Ord,
source§impl<K, V> LightningDecode for BTreeMap<K, V>where
K: LightningDecode + Ord,
V: LightningDecode,
impl<K, V> LightningDecode for BTreeMap<K, V>where
K: LightningDecode + Ord,
V: LightningDecode,
source§impl<K, V> LightningDecode for (K, V)where
K: LightningDecode + Clone,
V: LightningDecode + Clone,
impl<K, V> LightningDecode for (K, V)where
K: LightningDecode + Clone,
V: LightningDecode + Clone,
Two-component tuples are decoded as they were fields in the parent data structure