Crate bitcoin_consensus_encoding

Crate bitcoin_consensus_encoding 

Source
Expand description

§Rust Bitcoin - consensus encoding and decoding

This library provides traits that can be used to encode/decode objects in a consensus-consistent way.

Macros§

encoder_newtype
Implements a newtype around an encoder which implements the Encoder trait by forwarding to the wrapped encoder.

Structs§

ArrayDecoder
A decoder that expects exactly N bytes and returns them as an array.
ArrayEncoder
An encoder for a single array.
ByteVecDecoder
A decoder that decodes a byte vector.
ByteVecDecoderError
The error returned by the ByteVecDecoder.
BytesEncoder
An encoder for a single byte slice.
CompactSizeDecoder
Decodes a compact size encoded integer.
CompactSizeDecoderError
An error consensus decoding a compact size encoded integer.
CompactSizeEncoder
Encoder for a compact size encoded integer.
Decoder2
A decoder which wraps two inner decoders and returns the output of both.
Decoder3
A decoder which decodes three objects, one after the other.
Decoder4
A decoder which decodes four objects, one after the other.
Decoder6
A decoder which decodes six objects, one after the other.
Encoder2
An encoder which encodes two objects, one after the other.
Encoder3
An encoder which encodes three objects, one after the other.
Encoder4
An encoder which encodes four objects, one after the other.
Encoder6
An encoder which encodes six objects, one after the other.
LengthPrefixExceedsMaxError
Length prefix exceeds max value (4,000,000).
SliceEncoder
An encoder for a list of encodable types.
UnexpectedEofError
Not enough bytes given to decoder.
VecDecoder
A decoder that decodes a vector of Ts.
VecDecoderError
The error returned by the VecDecoder.

Enums§

Decoder2Error
Error type for Decoder2.
Decoder3Error
Error type for Decoder3.
Decoder4Error
Error type for Decoder4.
Decoder6Error
Error type for Decoder6.
ReadError
An error that can occur when reading and decoding from a buffered reader.

Traits§

Decodable
A Bitcoin object which can be consensus-decoded using a push decoder.
Decoder
A push decoder for a consensus-decodable object.
Encodable
A Bitcoin object which can be consensus-encoded.
Encoder
An encoder for a consensus-encodable object.

Functions§

cast_to_usize_if_valid
Cast a decoded length prefix to a usize.
decode_from_read
Decodes an object from a buffered reader.
decode_from_read_unbuffered
Decodes an object from an unbuffered reader using a fixed-size buffer.
decode_from_read_unbuffered_with
Decodes an object from an unbuffered reader using a custom-sized buffer.
decode_from_slice
Decodes an object from a byte slice.
encode_to_vec
Encodes an object into a vector.
encode_to_writer
Encodes an object to a standard I/O writer.