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:
commit
e7155f153d
|
@ -1,6 +1,11 @@
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
# v1.2.0
|
||||||
|
|
||||||
|
- Add `Mnemonic::parse_in_normalized_without_checksum_check`
|
||||||
|
- Make public `Mnemonic::normalize_utf8_cow`
|
||||||
|
|
||||||
# v1.1.0
|
# v1.1.0
|
||||||
|
|
||||||
- Add zerioze support through a feature (MSRV 1.51)
|
- Add zerioze support through a feature (MSRV 1.51)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bip39"
|
name = "bip39"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
authors = ["Steven Roose <steven@stevenroose.org>"]
|
authors = ["Steven Roose <steven@stevenroose.org>"]
|
||||||
license = "CC0-1.0"
|
license = "CC0-1.0"
|
||||||
homepage = "https://github.com/rust-bitcoin/rust-bip39/"
|
homepage = "https://github.com/rust-bitcoin/rust-bip39/"
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -180,7 +180,7 @@ impl Mnemonic {
|
||||||
/// can be avoided for languages without special UTF8 characters.
|
/// can be avoided for languages without special UTF8 characters.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(feature = "std")]
|
#[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());
|
let is_nfkd = unicode_normalization::is_nfkd_quick(cow.as_ref().chars());
|
||||||
if is_nfkd != unicode_normalization::IsNormalized::Yes {
|
if is_nfkd != unicode_normalization::IsNormalized::Yes {
|
||||||
*cow = Cow::Owned(cow.as_ref().nfkd().to_string());
|
*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.
|
/// 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();
|
let nb_words = s.split_whitespace().count();
|
||||||
if is_invalid_word_count(nb_words) {
|
if is_invalid_word_count(nb_words) {
|
||||||
return Err(Error::BadWordCount(nb_words));
|
return Err(Error::BadWordCount(nb_words));
|
||||||
|
|
Loading…
Reference in New Issue