Crate bip21

Source
Expand description

Rust-idiomatic, compliant, flexible and performant BIP21 crate.

Important: while lot of work went into polishing the crate it’s still considered early-development!

  • Rust-idiomatic: uses strong types, standard traits and other things
  • Compliant: implements all requirements of BIP21, including protections to not forget about req-. (But see features.)
  • Flexible: enables parsing/serializing additional arguments not defined by BIP21
  • Performant: uses zero-copy deserialization and lazy evaluation wherever possible.

Serialization and deserialization is inspired by serde with these important differences:

  • Deserialization signals if the field is known so that req- fields can be rejected.
  • Much simpler API - we don’t need all the features.
  • Use of [Param<'a>] to enable lazy evaluation.

The crate is no_std but does require alloc.

§Features

  • std enables integration with std - mainly std::error::Error.
  • non-compliant-bytes - enables use of non-compliant API that can parse non-UTF-8 URI values.

§Stabilization roadmap

The crate can not (and will not) be stabilized until either bitcoin is stabilized or bitcoin::Address and bitcoin::Amount are moved to (a) separate stable crate(s).

§MSRV

1.56.1

Re-exports§

pub use de::DeserializeParams;
pub use de::DeserializationState;
pub use de::DeserializationError;
pub use ser::SerializeParams;

Modules§

de
Types and traits related to deserialization (parsing) of BIP21
ser
Types and traits related to serialization (displaying) of BIP21

Structs§

EmptyState
This is a state used to deserialize NoExtras - it doesn’t expect any parameters.
NoExtras
Empty extras.
Param
Abstracted stringly parameter in the URI.
ParamBytesnon-compliant-bytes
Iterator over decoded bytes inside paramter.
ParamBytesOwnednon-compliant-bytes
Iterator over decoded bytes inside paramter.
Uri
Parsed BIP21 URI.