Trait lightning_encoding::LightningEncode [−][src]
pub trait LightningEncode {
fn lightning_encode<E: Write>(&self, e: E) -> Result<usize, Error>;
fn lightning_serialize(&self) -> Result<Vec<u8>, Error> { ... }
}
Expand description
Lightning-network specific encoding as defined in BOLT-1, 2, 3…
Required methods
Encode with the given std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type.
Provided methods
Serializes data as a byte array using
LightningEncode::lightning_encode
function.
Implementations on Foreign Types
impl<K, V> LightningEncode for (K, V) where
K: LightningEncode + Clone,
V: LightningEncode + Clone,
impl<K, V> LightningEncode for (K, V) where
K: LightningEncode + Clone,
V: LightningEncode + Clone,
Two-component tuples are encoded as they were fields in the parent data structure