MCPcopy Create free account
hub / github.com/conduition/musig2 / BinaryEncoding

Interface BinaryEncoding

src/binary_encoding.rs:5–15  ·  view source on GitHub ↗

Marks a type which can be serialized to and from a binary encoding of either fixed or variable length.

Source from the content-addressed store, hash-verified

3/// Marks a type which can be serialized to and from a binary encoding of either
4/// fixed or variable length.
5pub trait BinaryEncoding: Sized {
6 /// The binary type which is returned by serialization. Should either
7 /// be `[u8; N]` or `Vec<u8>`.
8 type Serialized;
9
10 /// Serialize this data structure to its binary representation.
11 fn to_bytes(&self) -> Self::Serialized;
12
13 /// Deserialize this data structure from a binary representation.
14 fn from_bytes(bytes: &[u8]) -> Result<Self, DecodeError<Self>>;
15}
16
17/// Implements various binary encoding traits for both fixed or
18/// variable-length encoded data structures.

Callers

nothing calls this directly

Implementers 3

signature.rssrc/signature.rs
nonces.rssrc/nonces.rs
key_agg.rssrc/key_agg.rs

Calls

no outgoing calls

Tested by

no test coverage detected