diff options
| -rw-r--r-- | content/posts/2026-03-08-pbech32-v0.1.0.md | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/content/posts/2026-03-08-pbech32-v0.1.0.md b/content/posts/2026-03-08-pbech32-v0.1.0.md index 4913886..276fd5e 100644 --- a/content/posts/2026-03-08-pbech32-v0.1.0.md +++ b/content/posts/2026-03-08-pbech32-v0.1.0.md @@ -60,9 +60,11 @@ use pbech32::{Encoder, Hrp, Scheme}; let mut vec: Vec<u8> = Vec::new(); // output vector let hrp: Hrp = "hello".parse()?; // human readable part -let mut encoder = Encoder::new(&mut vec, Scheme::Bech32m, hrp)?; // create encoder -encoder.write_all(b"folks")?; // write data -encoder.flush()?; // flush encoder (REQUIRED) +{ + let mut enc = Encoder::new(&mut vec, Scheme::Bech32m, hrp)?; // create encoder + enc.write_all(b"folks")?; // write data + enc.flush()?; // flush encoder (RECOMMENDED) +} let got = str::from_utf8(vec.as_ref())?; // convert output vector to string assert_eq!(got, "hello1vehkc6mn27xpct"); // check result @@ -72,6 +74,11 @@ assert_eq!(got, "hello1vehkc6mn27xpct"); // check result More examples are available in the [`examples/` directory][examples] of the [pbech32 Git repository][git repository]. +### Updates + +- 2026-03-27: [pbech32 v0.2.0][]: Add `impl Drop for Encoder`. Fix + clippy warnings. Minor documentation improvements. + [bech32]: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki "Bech32 (BIP173)" [bech32m]: https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki @@ -88,8 +95,6 @@ the [pbech32 Git repository][git repository]. "Checksum (Wikipedia)" [namespace]: https://en.wikipedia.org/wiki/Namespace "Namespace (Wikipedia)" -[bch code]: https://en.wikipedia.org/wiki/BCH_code - "BCH code (Wikipedia)" [alphabet]: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 "BIP173: Specification: Bech32" [writer]: https://doc.rust-lang.org/std/io/trait.Write.html @@ -128,3 +133,5 @@ the [pbech32 Git repository][git repository]. "std::fmt::Display trait" [fromstr]: https://doc.rust-lang.org/std/str/trait.FromStr.html "std::str::FromStr trait" +[pbech32 v0.2.0]: https://github.com/pablotron/pbech32/releases/tag/0.2.0 + "pbech32 version 0.2.0" |
