pub struct DerivationPath(_);
Expand description
A BIP-32 derivation path.
Implementations
sourceimpl DerivationPath
impl DerivationPath
sourcepub fn master() -> DerivationPath
pub fn master() -> DerivationPath
Returns derivation path for a master key (i.e. empty derivation path)
sourcepub fn is_master(&self) -> bool
pub fn is_master(&self) -> bool
Returns whether derivation path represents master key (i.e. it’s length
is empty). True for m
path.
sourcepub fn child(&self, cn: ChildNumber) -> DerivationPath
pub fn child(&self, cn: ChildNumber) -> DerivationPath
Create a new DerivationPath that is a child of this one.
sourcepub fn into_child(self, cn: ChildNumber) -> DerivationPath
pub fn into_child(self, cn: ChildNumber) -> DerivationPath
Convert into a DerivationPath that is a child of this one.
sourcepub fn children_from(&self, cn: ChildNumber) -> DerivationPathIterator<'_>ⓘNotable traits for DerivationPathIterator<'a>impl<'a> Iterator for DerivationPathIterator<'a> type Item = DerivationPath;
pub fn children_from(&self, cn: ChildNumber) -> DerivationPathIterator<'_>ⓘNotable traits for DerivationPathIterator<'a>impl<'a> Iterator for DerivationPathIterator<'a> type Item = DerivationPath;
Get an Iterator over the children of this DerivationPath starting with the given ChildNumber.
sourcepub fn normal_children(&self) -> DerivationPathIterator<'_>ⓘNotable traits for DerivationPathIterator<'a>impl<'a> Iterator for DerivationPathIterator<'a> type Item = DerivationPath;
pub fn normal_children(&self) -> DerivationPathIterator<'_>ⓘNotable traits for DerivationPathIterator<'a>impl<'a> Iterator for DerivationPathIterator<'a> type Item = DerivationPath;
Get an Iterator over the unhardened children of this DerivationPath.
sourcepub fn hardened_children(&self) -> DerivationPathIterator<'_>ⓘNotable traits for DerivationPathIterator<'a>impl<'a> Iterator for DerivationPathIterator<'a> type Item = DerivationPath;
pub fn hardened_children(&self) -> DerivationPathIterator<'_>ⓘNotable traits for DerivationPathIterator<'a>impl<'a> Iterator for DerivationPathIterator<'a> type Item = DerivationPath;
Get an Iterator over the hardened children of this DerivationPath.
sourcepub fn extend<T: AsRef<[ChildNumber]>>(&self, path: T) -> DerivationPath
pub fn extend<T: AsRef<[ChildNumber]>>(&self, path: T) -> DerivationPath
Concatenate self
with path
and return the resulting new path.
use bitcoin::util::bip32::{DerivationPath, ChildNumber};
use std::str::FromStr;
let base = DerivationPath::from_str("m/42").unwrap();
let deriv_1 = base.extend(DerivationPath::from_str("m/0/1").unwrap());
let deriv_2 = base.extend(&[
ChildNumber::from_normal_idx(0).unwrap(),
ChildNumber::from_normal_idx(1).unwrap()
]);
assert_eq!(deriv_1, deriv_2);
Trait Implementations
sourceimpl AsRef<[ChildNumber]> for DerivationPath
impl AsRef<[ChildNumber]> for DerivationPath
sourcefn as_ref(&self) -> &[ChildNumber]
fn as_ref(&self) -> &[ChildNumber]
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for DerivationPath
impl Clone for DerivationPath
sourcefn clone(&self) -> DerivationPath
fn clone(&self) -> DerivationPath
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DerivationPath
impl Debug for DerivationPath
sourceimpl Default for DerivationPath
impl Default for DerivationPath
sourcefn default() -> DerivationPath
fn default() -> DerivationPath
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for DerivationPath
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for DerivationPath
serde
only.sourcefn deserialize<D>(deserializer: D) -> Result<DerivationPath, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<DerivationPath, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for DerivationPath
impl Display for DerivationPath
sourceimpl<'a> From<&'a [ChildNumber]> for DerivationPath
impl<'a> From<&'a [ChildNumber]> for DerivationPath
sourcefn from(numbers: &'a [ChildNumber]) -> Self
fn from(numbers: &'a [ChildNumber]) -> Self
Converts to this type from the input type.
sourceimpl From<DerivationPath> for Vec<ChildNumber>
impl From<DerivationPath> for Vec<ChildNumber>
sourcefn from(path: DerivationPath) -> Self
fn from(path: DerivationPath) -> Self
Converts to this type from the input type.
sourceimpl From<Vec<ChildNumber, Global>> for DerivationPath
impl From<Vec<ChildNumber, Global>> for DerivationPath
sourcefn from(numbers: Vec<ChildNumber>) -> Self
fn from(numbers: Vec<ChildNumber>) -> Self
Converts to this type from the input type.
sourceimpl FromIterator<ChildNumber> for DerivationPath
impl FromIterator<ChildNumber> for DerivationPath
sourcefn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = ChildNumber>,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = ChildNumber>,
Creates a value from an iterator. Read more
sourceimpl FromStr for DerivationPath
impl FromStr for DerivationPath
sourceimpl Hash for DerivationPath
impl Hash for DerivationPath
sourceimpl<I> Index<I> for DerivationPath where
Vec<ChildNumber>: Index<I>,
impl<I> Index<I> for DerivationPath where
Vec<ChildNumber>: Index<I>,
sourceimpl<'a> IntoIterator for &'a DerivationPath
impl<'a> IntoIterator for &'a DerivationPath
type Item = &'a ChildNumber
type Item = &'a ChildNumber
The type of the elements being iterated over.
type IntoIter = Iter<'a, ChildNumber>
type IntoIter = Iter<'a, ChildNumber>
Which kind of iterator are we turning this into?
sourceimpl Ord for DerivationPath
impl Ord for DerivationPath
sourcefn cmp(&self, other: &DerivationPath) -> Ordering
fn cmp(&self, other: &DerivationPath) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<DerivationPath> for DerivationPath
impl PartialEq<DerivationPath> for DerivationPath
sourcefn eq(&self, other: &DerivationPath) -> bool
fn eq(&self, other: &DerivationPath) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &DerivationPath) -> bool
fn ne(&self, other: &DerivationPath) -> bool
This method tests for !=
.
sourceimpl PartialOrd<DerivationPath> for DerivationPath
impl PartialOrd<DerivationPath> for DerivationPath
sourcefn partial_cmp(&self, other: &DerivationPath) -> Option<Ordering>
fn partial_cmp(&self, other: &DerivationPath) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for DerivationPath
Available on crate feature serde
only.
impl Serialize for DerivationPath
serde
only.impl Eq for DerivationPath
impl StructuralEq for DerivationPath
impl StructuralPartialEq for DerivationPath
Auto Trait Implementations
impl RefUnwindSafe for DerivationPath
impl Send for DerivationPath
impl Sync for DerivationPath
impl Unpin for DerivationPath
impl UnwindSafe for DerivationPath
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoDerivationPath for T where
T: Into<DerivationPath>,
impl<T> IntoDerivationPath for T where
T: Into<DerivationPath>,
sourcefn into_derivation_path(self) -> Result<DerivationPath, Error>
fn into_derivation_path(self) -> Result<DerivationPath, Error>
Convers a given type into a DerivationPath
with possible error