Move Mnemonic::parse_in above Mnemonic::parse
This commit is contained in:
parent
cb9d5f91d8
commit
077d594aca
16
src/lib.rs
16
src/lib.rs
|
@ -260,6 +260,14 @@ impl Mnemonic {
|
||||||
Err(Error::AmbiguousWordList(langs))
|
Err(Error::AmbiguousWordList(langs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parse a mnemonic in the given language.
|
||||||
|
pub fn parse_in<'a, S: Into<Cow<'a, str>>>(language: Language, s: S) -> Result<Mnemonic, Error> {
|
||||||
|
let mut cow = s.into();
|
||||||
|
Mnemonic::normalize_utf8_cow(&mut cow);
|
||||||
|
Mnemonic::validate_in(language, cow.as_ref())?;
|
||||||
|
Ok(Mnemonic(cow.into_owned()))
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse a mnemonic and detect the language from the enabled languages.
|
/// Parse a mnemonic and detect the language from the enabled languages.
|
||||||
pub fn parse<'a, S: Into<Cow<'a, str>>>(s: S) -> Result<Mnemonic, Error> {
|
pub fn parse<'a, S: Into<Cow<'a, str>>>(s: S) -> Result<Mnemonic, Error> {
|
||||||
let mut cow = s.into();
|
let mut cow = s.into();
|
||||||
|
@ -269,14 +277,6 @@ impl Mnemonic {
|
||||||
Ok(Mnemonic(cow.into_owned()))
|
Ok(Mnemonic(cow.into_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a mnemonic in the given language.
|
|
||||||
pub fn parse_in<'a, S: Into<Cow<'a, str>>>(language: Language, s: S) -> Result<Mnemonic, Error> {
|
|
||||||
let mut cow = s.into();
|
|
||||||
Mnemonic::normalize_utf8_cow(&mut cow);
|
|
||||||
Mnemonic::validate_in(language, cow.as_ref())?;
|
|
||||||
Ok(Mnemonic(cow.into_owned()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the mnemonic as a [&str].
|
/// Get the mnemonic as a [&str].
|
||||||
pub fn as_str(&self) -> &str {
|
pub fn as_str(&self) -> &str {
|
||||||
&self.0
|
&self.0
|
||||||
|
|
Loading…
Reference in New Issue