Merge pull request #44 from rust-bitcoin/bump-1.2.0

Rename new method to be in line with existing API and release v1.2.0
This commit is contained in:
Steven Roose 2023-02-26 23:35:49 +00:00 committed by GitHub
commit e7155f153d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -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)

View File

@ -1,6 +1,6 @@
[package]
name = "bip39"
version = "1.1.0"
version = "1.2.0"
authors = ["Steven Roose <steven@stevenroose.org>"]
license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-bip39/"

View File

@ -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());
@ -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<Mnemonic, Error> {
///
/// 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<Mnemonic, Error> {
let nb_words = s.split_whitespace().count();
if is_invalid_word_count(nb_words) {
return Err(Error::BadWordCount(nb_words));