Macro blob

Source
macro_rules! blob {
    ($name:ident, $size:expr, $doc:expr) => { ... };
}
Expand description

Creates a new type wrapping a fixed-size byte array with common methods and trait implementations.

The blob! macro generates a new type that wraps a Blob<N> of the specified size, automatically implementing common methods and traits. This provides a convenient way to create domain-specific types for fixed-size binary data with minimal boilerplate.

§Usage

blob!(TxId, 32, "A transaction identifier as a 32-byte hash");

§Generated Functionality

The generated type includes methods for creation, conversion, and inspection, as well as implementations for common traits like Parse, Debug, Clone, and various conversion traits to and from byte collections.

The macro adds type safety and domain-specific semantics to otherwise generic byte array data, particularly for cryptographic values used in the Zcash protocol.