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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl LightningDecode for u8
impl LightningDecode for u8
Source§impl LightningDecode for u16
impl LightningDecode for u16
Source§impl LightningDecode for u32
impl LightningDecode for u32
Source§impl LightningDecode for u64
impl LightningDecode for u64
Source§impl LightningDecode for usize
impl LightningDecode for usize
Source§impl LightningDecode for Box<[u8]>
impl LightningDecode for Box<[u8]>
Source§impl LightningDecode for String
impl LightningDecode for String
Source§impl LightningDecode for FlagVec
impl LightningDecode for FlagVec
Source§impl LightningDecode for Slice32
impl LightningDecode for Slice32
Source§impl LightningDecode for u24
impl LightningDecode for u24
Source§impl LightningDecode for Script
impl LightningDecode for Script
Source§impl<K, V> LightningDecode for (K, V)
Two-component tuples are decoded as they were fields in the parent
data structure
impl<K, V> LightningDecode for (K, V)
Two-component tuples are decoded as they were fields in the parent data structure