Struct deep_space::mnemonic::Mnemonic [−][src]
A mnemonic code.
The std::str::FromStr implementation will try to determine the language of the mnemonic from all the supported languages. (Languages have to be explicitly enabled using the Cargo features.)
Supported number of words are 12, 18 and 24.
Implementations
impl Mnemonic[src]
pub fn from_entropy_in(
language: Language,
entropy: &[u8]
) -> Result<Mnemonic, Bip39Error>[src]
language: Language,
entropy: &[u8]
) -> Result<Mnemonic, Bip39Error>
Create a new Mnemonic in the specified language from the given entropy. Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.
pub fn from_entropy(entropy: &[u8]) -> Result<Mnemonic, Bip39Error>[src]
Create a new English Mnemonic in from the given entropy. Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.
pub fn generate_in(
language: Language,
word_count: usize
) -> Result<Mnemonic, Bip39Error>[src]
language: Language,
word_count: usize
) -> Result<Mnemonic, Bip39Error>
Generate a new Mnemonic in the given language. For the different supported word counts, see documentation on [Mnemonoc].
pub fn generate(word_count: usize) -> Result<Mnemonic, Bip39Error>[src]
Generate a new Mnemonic in English. For the different supported word counts, see documentation on [Mnemonoc].
pub fn validate_in(language: Language, s: &str) -> Result<(), Bip39Error>[src]
Static method to validate a mnemonic in a given language.
pub fn language_of(s: &str) -> Result<Language, Bip39Error>[src]
Determine the language of the mnemonic.
NOTE: This method only guarantees that the returned language is the correct language on the assumption that the mnemonic is valid. It does not itself validate the mnemonic.
Some word lists don’t guarantee that their words don’t occur in other word lists. In the extremely unlikely case that a word list can be interpreted in multiple languages, an [Error::AmbiguousWordList] is returned, containing the possible languages.
pub fn parse<'a, S: Into<Cow<'a, str>>>(s: S) -> Result<Mnemonic, Bip39Error>[src]
Parse a mnemonic and detect the language from the enabled languages.
pub fn parse_in<'a, S: Into<Cow<'a, str>>>(
language: Language,
s: S
) -> Result<Mnemonic, Bip39Error>[src]
language: Language,
s: S
) -> Result<Mnemonic, Bip39Error>
Parse a mnemonic in the given language.
pub fn as_str(&self) -> &str[src]
Get the mnemonic as a &str.
pub fn word_count(&self) -> usize[src]
Get the number of words in the mnemonic.
pub fn to_seed(&self, passphrase: &str) -> Vec<u8>[src]
Convert to seed bytes.
pub fn to_entropy(&self) -> Vec<u8>[src]
Convert the mnemonic back to the entropy used to generate it.
Trait Implementations
impl Clone for Mnemonic[src]
impl Debug for Mnemonic[src]
impl Display for Mnemonic[src]
impl Eq for Mnemonic[src]
impl FromStr for Mnemonic[src]
type Err = Bip39Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Mnemonic, Bip39Error>[src]
impl Hash for Mnemonic[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for Mnemonic[src]
fn cmp(&self, other: &Mnemonic) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<Mnemonic> for Mnemonic[src]
impl PartialOrd<Mnemonic> for Mnemonic[src]
fn partial_cmp(&self, other: &Mnemonic) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for Mnemonic[src]
impl StructuralPartialEq for Mnemonic[src]
Auto Trait Implementations
impl RefUnwindSafe for Mnemonic
impl Send for Mnemonic
impl Sync for Mnemonic
impl Unpin for Mnemonic
impl UnwindSafe for Mnemonic
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> IntoRequest<T> for T[src]
pub fn into_request(self) -> Request<T>[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>, [src]
S: Into<Dispatch>,