Struct walletd_bitcoin::HDPath
source · pub struct HDPath { /* private fields */ }
Expand description
Contains a vector of HDPathIndex to represent a derivation path for a HDKey and relevant helper functions.
Implementations§
source§impl HDPath
impl HDPath
sourcepub fn new(path: &str) -> Result<HDPath, Error>
pub fn new(path: &str) -> Result<HDPath, Error>
Creates a new HDPath
from a string representation of the path.
sourcepub fn push(&mut self, index: HDPathIndex)
pub fn push(&mut self, index: HDPathIndex)
Pushes a new HDPathIndex
to the path
sourcepub fn derive_path_str_to_list(
deriv_path: &str
) -> Result<Vec<String, Global>, Error>
pub fn derive_path_str_to_list( deriv_path: &str ) -> Result<Vec<String, Global>, Error>
Helper function to convert a derivation path string to a list of strings
Returns Error
if the path is empty or does not start with “m”
sourcepub fn to_vec(&self) -> Vec<HDPathIndex, Global>
pub fn to_vec(&self) -> Vec<HDPathIndex, Global>
Returns the underlying vector of HDPathIndex
sourcepub fn derive_path_str_to_info(
deriv_path: &str
) -> Result<Vec<HDPathIndex, Global>, Error>
pub fn derive_path_str_to_info( deriv_path: &str ) -> Result<Vec<HDPathIndex, Global>, Error>
Helper function to convert a derivation path string to a vector of
HDPathIndex
Returns an Error
variant if the derivation path string is invalid
sourcepub fn builder() -> HDPathBuilder
pub fn builder() -> HDPathBuilder
Returns the builder for the HDPath (HDPathBuilder)
sourcepub fn at(&self, index: usize) -> Result<HDPathIndex, Error>
pub fn at(&self, index: usize) -> Result<HDPathIndex, Error>
Returns the HDPathIndex object at the specified position (index) in the path if it exists, otherwise returns an error
sourcepub fn purpose(&self) -> Result<HDPurpose, Error>
pub fn purpose(&self) -> Result<HDPurpose, Error>
Returns the HDPurpose value related to the purpose attribute, if it exists in the HDPath
Returns an error Error::IndexOutOfRange
if the index 1 is not valid
for the HDPath object
sourcepub fn coin_type(&self) -> Result<HDPathIndex, Error>
pub fn coin_type(&self) -> Result<HDPathIndex, Error>
Returns the HDPathIndex value related to the coin_type attribute, if it exists in the HDPath
Returns an error Error::IndexOutOfRange
if the index is not valid for
the HDPath object
sourcepub fn account(&self) -> Result<HDPathIndex, Error>
pub fn account(&self) -> Result<HDPathIndex, Error>
Returns the HDPathIndex value related to the account attribute, if it exists in the HDPath
Returns an error Error::IndexOutOfRange
if the index is not valid for
the HDPath object
sourcepub fn change(&self) -> Result<HDPathIndex, Error>
pub fn change(&self) -> Result<HDPathIndex, Error>
Returns the HDPathIndex value related to the change attribute, if it exists in the HDPath
Returns an error Error::IndexOutOfRange
if the index is not valid for
the HDPath object
sourcepub fn address(&self) -> Result<HDPathIndex, Error>
pub fn address(&self) -> Result<HDPathIndex, Error>
Returns the HDPathIndex value related to the address attribute, if it exists in the HDPath
Returns an error Error::IndexOutOfRange
if the index is not valid for
the HDPath object
Trait Implementations§
source§impl Ord for HDPath
impl Ord for HDPath
source§impl PartialEq<HDPath> for HDPath
impl PartialEq<HDPath> for HDPath
source§impl PartialOrd<HDPath> for HDPath
impl PartialOrd<HDPath> for HDPath
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 moreimpl Eq for HDPath
impl StructuralEq for HDPath
impl StructuralPartialEq for HDPath
Auto Trait Implementations§
impl RefUnwindSafe for HDPath
impl Send for HDPath
impl Sync for HDPath
impl Unpin for HDPath
impl UnwindSafe for HDPath
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.