pub struct DerivationPath(_);
Expand description

A Bip32 derivation path

Implementations§

source§

impl DerivationPath

source

pub fn last(&self) -> Option<&u32>

Return the last index in the path. None if the path is the root.

source

pub fn derivation_string(&self) -> String

Converts the path to a standard bip32 string. e.g "m/44'/0'/0/32".

source

pub fn is_empty(&self) -> bool

Returns True if there are no indices in the path

source

pub fn len(&self) -> usize

The number of derivations in the path

source

pub fn iter(&self) -> Iter<'_, u32>

Make an iterator over the path indices

source

pub fn starts_with(&self, other: &Self) -> bool

true if other is a prefix of self

source

pub fn without_prefix(&self, prefix: &Self) -> Option<DerivationPath>

Remove a prefix from a derivation. Return a new DerivationPath without the prefix. This is useful for determining the path to rech some descendant from some ancestor.

source

pub fn last_hardened(&self) -> (usize, Option<u32>)

Convenience function for finding the last hardened derivation in a path. Returns the index and the element. If there is no hardened derivation, it will return (0, None).

source

pub fn resized(&self, size: usize, pad_with: u32) -> Self

Return a clone with a resized path. If the new size is shorter, this truncates it. If the new path is longer, we pad with the second argument.

source

pub fn extended(&self, idx: u32) -> Self

Append an additional derivation to the end, return a clone

Trait Implementations§

source§

impl Clone for DerivationPath

source§

fn clone(&self) -> DerivationPath

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 Debug for DerivationPath

source§

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

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

impl Default for DerivationPath

source§

fn default() -> DerivationPath

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for DerivationPath

source§

fn deserialize<D>(deserializer: D) -> Result<DerivationPath, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&[u32]> for DerivationPath

source§

fn from(v: &[u32]) -> Self

Converts to this type from the input type.
source§

impl From<&DerivationPath> for DerivationPath

source§

fn from(v: &DerivationPath) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<u32, Global>> for DerivationPath

source§

fn from(v: &Vec<u32>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<u32, Global>> for DerivationPath

source§

fn from(v: Vec<u32>) -> Self

Converts to this type from the input type.
source§

impl FromIterator<u32> for DerivationPath

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = u32>,

Creates a value from an iterator. Read more
source§

impl FromStr for DerivationPath

§

type Err = Bip32Error

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

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl PartialEq<DerivationPath> for DerivationPath

source§

fn eq(&self, other: &DerivationPath) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for DerivationPath

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&str> for DerivationPath

§

type Error = Bip32Error

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

fn try_from(v: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<u32> for DerivationPath

§

type Error = Bip32Error

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

fn try_from(v: u32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for DerivationPath

source§

impl StructuralEq for DerivationPath

source§

impl StructuralPartialEq for DerivationPath

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, 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.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,