Enum walletd_bitcoin::HDPathIndex
source · pub enum HDPathIndex {
Master,
IndexHardened(u32),
IndexNotHardened(u32),
}
Expand description
Represents the variants of different derivation path components.
The HDPath
struct contains a vector of these values.
Variants§
Master
Master index is the root of the derivation tree, it is represented as m in the string path
IndexHardened(u32)
IndexHardened is a hardened index, it is represented as a number followed by ’ in the string path The number is the short form value, the full index value is the short form value + 2^31
IndexNotHardened(u32)
IndexNotHardened is a non-hardened index, it is represented as a number in the string path The number is the short form value, the full index value is the same short form value when the index is not hardened
Implementations§
source§impl HDPathIndex
impl HDPathIndex
sourcepub fn hardened_full_num(num: u32) -> u32
pub fn hardened_full_num(num: u32) -> u32
Convert to the full number used to represent a hardend index from the shortform number used in the derivation path string accompanied by ’ to indicate hardened
sourcepub fn hardened_shortform_num(full_num: u32) -> u32
pub fn hardened_shortform_num(full_num: u32) -> u32
Convert from the full number used represent a hardened index to the shortform number which when accompanied by ’ indicates a hardened index
sourcepub fn to_shortform_num(&self) -> u32
pub fn to_shortform_num(&self) -> u32
Returns the short form value of index. For master type always returns 0, for hardened index returns the short form value without the hardened indicator, the value here for hardened index is not the same as the full index number which is used in the calculation but rather the short form value used in the derivation string when accompanied by the ’ indicator For non-hardened index returns the the shortform number and full number are the same.
sourcepub fn to_full_num(&self) -> u32
pub fn to_full_num(&self) -> u32
Returns the full index value, for non-hardened index this is the same as the short form value, for hardened index this is the full index value used in the calculation
sourcepub fn new_master() -> HDPathIndex
pub fn new_master() -> HDPathIndex
Creates a master HDPathIndex
sourcepub fn new_index(num: u32, hardened: bool) -> HDPathIndex
pub fn new_index(num: u32, hardened: bool) -> HDPathIndex
Creates a new index (not master) from the short form index and a boolean which indicates if the index is hardened or not
Arguments
num
- the short form index value, the value here for hardened index is not the same as the full index number which is used in the calculation but rather the short form value used in the derivation string when accompanied by the ’ indicatorhardened
- boolean indicating if the index is hardened or not
Trait Implementations§
source§impl Clone for HDPathIndex
impl Clone for HDPathIndex
source§fn clone(&self) -> HDPathIndex
fn clone(&self) -> HDPathIndex
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for HDPathIndex
impl Debug for HDPathIndex
source§impl Display for HDPathIndex
impl Display for HDPathIndex
source§impl From<&HDPurpose> for HDPathIndex
impl From<&HDPurpose> for HDPathIndex
source§fn from(purpose: &HDPurpose) -> HDPathIndex
fn from(purpose: &HDPurpose) -> HDPathIndex
source§impl FromStr for HDPathIndex
impl FromStr for HDPathIndex
source§impl Ord for HDPathIndex
impl Ord for HDPathIndex
source§fn cmp(&self, other: &HDPathIndex) -> Ordering
fn cmp(&self, other: &HDPathIndex) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<HDPathIndex> for HDPathIndex
impl PartialEq<HDPathIndex> for HDPathIndex
source§fn eq(&self, other: &HDPathIndex) -> bool
fn eq(&self, other: &HDPathIndex) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<HDPathIndex> for HDPathIndex
impl PartialOrd<HDPathIndex> for HDPathIndex
source§fn partial_cmp(&self, other: &HDPathIndex) -> Option<Ordering>
fn partial_cmp(&self, other: &HDPathIndex) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<HDPathIndex> for HDPurpose
impl TryFrom<HDPathIndex> for HDPurpose
impl Copy for HDPathIndex
impl Eq for HDPathIndex
impl StructuralEq for HDPathIndex
impl StructuralPartialEq for HDPathIndex
Auto Trait Implementations§
impl RefUnwindSafe for HDPathIndex
impl Send for HDPathIndex
impl Sync for HDPathIndex
impl Unpin for HDPathIndex
impl UnwindSafe for HDPathIndex
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.