bdk_chain::bitcoin::bech32::primitives

Module iter

Expand description

Iterator Adaptors.

Iterator extension traits and blanket implementations to convert:

  • BytesToFes: An iterator over bytes to an iterator over field elements.
  • FesToBytes: An iterator over field elements to an iterator over bytes.
  • Checksummed: An iterator over field elements that appends the checksum.

WARNING: This module does not enforce the maximum length of an encoded bech32 string (90 chars).

§Examples

use bech32::{Bech32, ByteIterExt, Fe32IterExt, Fe32, Hrp};

let data = [
    0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4,
    0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23,
    0xf1, 0x43, 0x3b, 0xd6,
];

// Convert byte data to GF32 field elements.
let fe_iter = data.iter().copied().bytes_to_fes();

// Convert field elements back to bytes.
let byte_iter = fe_iter.fes_to_bytes();

Structs§

  • Iterator adaptor that converts bytes to GF32 elements.
  • Iterator adaptor for field-element-yielding iterator, which tacks a checksum onto the end of the yielded data.
  • Iterator adaptor that converts GF32 elements to bytes.

Traits§

  • Extension trait for byte iterators which provides an adaptor to GF32 elements.
  • Extension trait for field element iterators.