Trait LightningDecode

Source
pub trait LightningDecode
where 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§

Source

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§

Source

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

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for u16

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for u32

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for u64

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for usize

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for Box<[u8]>

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for String

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for FlagVec

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for Slice32

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for u24

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl LightningDecode for Script

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<K, V> LightningDecode for (K, V)

Two-component tuples are decoded as they were fields in the parent data structure

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<K, V> LightningDecode for BTreeMap<K, V>

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<K, V> LightningDecode for HashMap<K, V>

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for Option<T>
where T: LightningDecode,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for BTreeSet<T>
where T: LightningDecode + Ord,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for Vec<T>
where T: LightningDecode,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for HashSet<T>
where T: LightningDecode + Eq + Hash,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for Holder<T, AsBigSize>
where T: From<BigSize>,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for Holder<T, AsBitcoinHash>
where T: Hash + StrictDecode,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for Holder<T, AsStrict>
where T: StrictDecode,

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<T> LightningDecode for Holder<T, AsWrapped>

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Source§

impl<const LEN: usize> LightningDecode for [u8; LEN]

Source§

fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>

Implementors§