Crate bitsplain

Source
Expand description

Bitsplain is a library that helps people understand Bitcoin-related binary data. When provided with some data — be it a binary file, hex-encoded string or any other commonly used encoding scheme — Bitsplain first tries to identify what the data represent and if it succeeds it offers an explanation of the data through “annotations”. These annotations consist of description, data type, rendered value, position in the binary input etc.

The library does not interpret the annotations, however crate bitsplain-bin offers two user interfaces, a CLI and GTK.

§Use it

Calling bitsplain::decode::decode_input(input) will return a vector of candidates. Each of the candidates contains reference to decoder which successfully parsed the data, the tree of annotations and view over original binary data.

§How it works?

Bitsplain uses nom to implement parsers of all the supported data formats. Using custom parser implementation it can track every value that the parser returns and its position within the data. All this information is assembled in a tree of Values, which is then returned for interpretation. Writers of data parsers can use a convenient DSL.

Re-exports§

pub use bitcoin;
pub use hex;
pub use nom;

Modules§

binary
Functions decoding textual input according to various encoding schemes.
decode
Core types and functions related to decoding of binary data.
dsl
Domain-specific language for defining annotations.
parse
Customization of nom parser and all related functions and types.
tree
Hierarchical structure of Values that is built during parsing of the binary input.
types
Basic and common data types and their parsers.
value
Value is intermediate type between domain-specific types and final presentation.

Macros§

decoder
Registers new decoder, defined by parser function, under a specified name. Optionally a condidition, in form of a pattern match, can be added.