Struct bip32::ExtendedKey

source ·
pub struct ExtendedKey {
    pub prefix: Prefix,
    pub attrs: ExtendedKeyAttrs,
    pub key_bytes: [u8; 33],
}
Expand description

Serialized extended key (e.g. xprv and xpub).

Fields§

§prefix: Prefix

Prefix (a.k.a. “version”) of the key (e.g. xprv, xpub)

§attrs: ExtendedKeyAttrs

Extended key attributes.

§key_bytes: [u8; 33]

Key material (may be public or private).

Includes an extra byte for a public key’s SEC1 tag.

Implementations§

source§

impl ExtendedKey

source

pub const BYTE_SIZE: usize = 78usize

Size of an extended key when deserialized into bytes from Base58.

source

pub const MAX_BASE58_SIZE: usize = 112usize

Maximum size of a Base58Check-encoded extended key in bytes.

Note that extended keys can also be 111-bytes.

source

pub fn write_base58<'a>(&self, buffer: &'a mut [u8; 112]) -> Result<&'a str>

Write a Base58-encoded key to the provided buffer, returning a &str containing the serialized data.

Note that this type also impls Display and therefore you can obtain an owned string by calling to_string().

Trait Implementations§

source§

impl Clone for ExtendedKey

source§

fn clone(&self) -> ExtendedKey

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Display for ExtendedKey

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for ExtendedKey

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl FromStr for ExtendedKey

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(base58: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl<K> TryFrom<ExtendedKey> for ExtendedPrivateKey<K>where K: PrivateKey,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(extended_key: ExtendedKey) -> Result<ExtendedPrivateKey<K>>

Performs the conversion.
source§

impl<K> TryFrom<ExtendedKey> for ExtendedPublicKey<K>where K: PublicKey,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(extended_key: ExtendedKey) -> Result<ExtendedPublicKey<K>>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.