From 6b79d78c80e3ca291105ebffbee6db36bc7edfd1 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sun, 26 Feb 2023 18:36:09 +0000 Subject: [PATCH 1/3] Make normalize_utf8_cow public --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5a8fa1d..29d4dc0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -180,7 +180,7 @@ impl Mnemonic { /// can be avoided for languages without special UTF8 characters. #[inline] #[cfg(feature = "std")] - fn normalize_utf8_cow<'a>(cow: &mut Cow<'a, str>) { + pub fn normalize_utf8_cow<'a>(cow: &mut Cow<'a, str>) { let is_nfkd = unicode_normalization::is_nfkd_quick(cow.as_ref().chars()); if is_nfkd != unicode_normalization::IsNormalized::Yes { *cow = Cow::Owned(cow.as_ref().nfkd().to_string()); From d3c96b144857c36242b7b18c8487e0364e0b8e71 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sun, 26 Feb 2023 18:36:34 +0000 Subject: [PATCH 2/3] Rename new method to Mnemonic::parse_in_normalized_without_checksum_check This is according with the other methods in the API. --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 29d4dc0..35419c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -435,7 +435,14 @@ impl Mnemonic { } /// Parse a mnemonic in normalized UTF8 in the given language without checksum check. - pub fn parse_without_checksum_check(language: Language, s: &str) -> Result { + /// + /// It is advised to use this method together with the utility methods + /// - [Mnemonic::normalize_utf8_cow] + /// - [Mnemonic::language_of] + pub fn parse_in_normalized_without_checksum_check( + language: Language, + s: &str, + ) -> Result { let nb_words = s.split_whitespace().count(); if is_invalid_word_count(nb_words) { return Err(Error::BadWordCount(nb_words)); From 1d83393b8d49177bafa2f98fbf2ec1f9325d8a4c Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Sun, 26 Feb 2023 18:37:01 +0000 Subject: [PATCH 3/3] Bump to v1.2.0 and update changelog --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9789447..ad03ebe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +# v1.2.0 + +- Add `Mnemonic::parse_in_normalized_without_checksum_check` +- Make public `Mnemonic::normalize_utf8_cow` + # v1.1.0 - Add zerioze support through a feature (MSRV 1.51) diff --git a/Cargo.toml b/Cargo.toml index 5367452..0d8193e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bip39" -version = "1.1.0" +version = "1.2.0" authors = ["Steven Roose "] license = "CC0-1.0" homepage = "https://github.com/rust-bitcoin/rust-bip39/"