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

source

pub fn new(path: &str) -> Result<HDPath, Error>

Creates a new HDPath from a string representation of the path.

source

pub fn push(&mut self, index: HDPathIndex)

Pushes a new HDPathIndex to the path

source

pub fn len(&self) -> usize

Returns the length of the path

source

pub fn is_empty(&self) -> bool

Returns true if the path is empty, false otherwise

source

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”

source

pub fn to_vec(&self) -> Vec<HDPathIndex, Global>

Returns the underlying vector of HDPathIndex

source

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

source

pub fn builder() -> HDPathBuilder

Returns the builder for the HDPath (HDPathBuilder)

source

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

source

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

source

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

source

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

source

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

source

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 Clone for HDPath

source§

fn clone(&self) -> HDPath

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 HDPath

source§

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

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

impl Default for HDPath

source§

fn default() -> HDPath

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

impl Display for HDPath

source§

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

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

impl From<Vec<HDPathIndex, Global>> for HDPath

source§

fn from(path: Vec<HDPathIndex, Global>) -> HDPath

Converts to this type from the input type.
source§

impl FromStr for HDPath

§

type Err = Error

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

fn from_str(s: &str) -> Result<HDPath, Error>

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

impl Ord for HDPath

source§

fn cmp(&self, other: &HDPath) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<HDPath> for HDPath

source§

fn eq(&self, other: &HDPath) -> 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 PartialOrd<HDPath> for HDPath

source§

fn partial_cmp(&self, other: &HDPath) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for HDPath

source§

impl StructuralEq for HDPath

source§

impl StructuralPartialEq for HDPath

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<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more