Crate binary_sv2

Source
Expand description

Export custom implementations of the binary_sv2 protocol, enabling encoding and decoding through custom traits.

§Overview

This crate will re-export implementations of theDeserialize and Serialize traits from a custom implementation provided by binary_codec_sv2 and derive_codec_sv2. This allows for flexible integration of SV2 protocol types and binary serialization.

§Features

  • prop_test: Adds support for property testing for protocol types.
  • with_buffer_pool: Enables support for buffer pooling to optimize memory usage during serialization and deserialization.

Re-exports§

pub use binary_codec_sv2;

Modules§

decodable
encodable

Structs§

CVec
CVec2
Seq0255
The liftime is here only for type compatibility with serde-sv2
Seq064K
The liftime is here only for type compatibility with serde-sv2
Sv2Option
The liftime is here only for type compatibility with serde-sv2
U24

Enums§

CError
FFI-safe Error
EncodableField
Error

Traits§

Decodable
Implmented by all the decodable structure, it can be derived for every structure composed only by primitives or other Decodable.
Deserialize
Implmented by all the decodable structure, it can be derived for every structure composed only by primitives or other Decodable.
Encodable
Fixed
Implemented by all the primitives with a fixed size
GetMarker
GetSize
Return the encoded byte size of an Encodable comprehensive of the header, if any
Serialize
SizeHint
Return the encoded byte size or a Decodable
Sv2DataType

Functions§

_c_export_cvec
_c_export_cvec2
_c_export_u24
clone_message
Does nothing and will be removed during refactor
cvec2_push
The caller is reponsible for NOT adding duplicate cvecs to the cvec2 structure, as this can lead to double free errors when the message is dropped.
cvec_from_buffer
Given a C allocated buffer return a rust allocated CVec
free_vec
free_vec_2
from_bytes
init_cvec2
Safety
to_bytes
to_writer
u256_from_int
Converts a value implementing the Into<u64> trait into a custom U256 type.

Type Aliases§

B016M
B0255
B032
B064K
PubKey
ShortTxId
Signature
Str0255
U32AsRef
U256

Derive Macros§

Deserialize
Derives the Decodable trait, generating implementations for deserializing a struct from a byte stream, including its structure, field decoding, and a method for creating a static version.
Serialize
Derives the Encodable trait, generating implementations for serializing a struct into an encoded format, including methods for field serialization, calculating the encoded size, and handling cases where the struct is already sized.