Struct HDPathBuilder

Source
pub struct HDPathBuilder {
    pub purpose: Option<u32>,
    pub purpose_hardened: bool,
    pub coin_type: Option<u32>,
    pub coin_type_hardened: bool,
    pub account: Option<u32>,
    pub account_hardened: bool,
    pub change: Option<u32>,
    pub change_hardened: bool,
    pub address_index: Option<u32>,
    pub address_index_hardened: bool,
}
Expand description

A builder for the HDPath struct, it allows specification of the standard full path and also which components are hardened. The default implementation uses the standard format for the full path.

Fields§

§purpose: Option<u32>

purpose shortform index value, default is None, it should be specified based on the HDPurpose

§purpose_hardened: bool

boolean indicating if the purpose index is hardened or not, default is true (hardened)

§coin_type: Option<u32>

coin_type shortform index value, default is None, it should be specified based on the coin

§coin_type_hardened: bool

boolean indicating if the coin_type index is hardened or not, default is true (hardened)

§account: Option<u32>

account shortform index value, default is Some(0)

§account_hardened: bool

boolean indicating if the account index is hardened or not, default is true (hardened)

§change: Option<u32>

change shortform index value, default is Some(0)

§change_hardened: bool

boolean indicating if the change index is hardened or not, default is false (not hardened)

§address_index: Option<u32>

address_index shortform index value, default is Some(0)

§address_index_hardened: bool

boolean indicating if the address_index index is hardened or not, default is false (not hardened)

Implementations§

Source§

impl HDPathBuilder

Source

pub fn new() -> HDPathBuilder

Creates a new HDPathBuilder with default values

Source

pub fn purpose_index(&mut self, purpose: u32) -> &mut HDPathBuilder

Specify the purpose index shortform number value

Source

pub fn hardened_purpose(&mut self) -> &mut HDPathBuilder

Specify that the purpose index should be hardened

Source

pub fn non_hardened_purpose(&mut self) -> &mut HDPathBuilder

Specify that the purpose index should not be hardened

Source

pub fn coin_type_index(&mut self, coin_type: u32) -> &mut HDPathBuilder

Specify the coin_type index shortform number value

Source

pub fn hardened_coin_type(&mut self) -> &mut HDPathBuilder

Specify that the coin type index should be hardened

Source

pub fn non_hardened_coin_type(&mut self) -> &mut HDPathBuilder

Specify that the coin type index should not be hardened

Source

pub fn account_index(&mut self, account: u32) -> &mut HDPathBuilder

Specify the account index shortform number value

Source

pub fn hardened_account(&mut self) -> &mut HDPathBuilder

Specify that the account index should be hardened

Source

pub fn non_hardened_account(&mut self) -> &mut HDPathBuilder

Specify that the account index should not be hardened

Source

pub fn change_index(&mut self, change: u32) -> &mut HDPathBuilder

Specify the change index shortform number value

Source

pub fn hardened_change(&mut self) -> &mut HDPathBuilder

Specify that the change index should be hardened

Source

pub fn non_hardened_change(&mut self) -> &mut HDPathBuilder

Specify that the change index should not be hardened

Source

pub fn address_index(&mut self, address_index: u32) -> &mut HDPathBuilder

Specify the address_index index shortform number value

Source

pub fn hardened_address(&mut self) -> &mut HDPathBuilder

Specify that the address index should be hardened

Source

pub fn non_hardened_address(&mut self) -> &mut HDPathBuilder

Specify that the address index should not be hardened

Source

pub fn no_purpose_index(&mut self) -> &mut HDPathBuilder

Set the purpose index to None

Source

pub fn no_coin_type_index(&mut self) -> &mut HDPathBuilder

Set the coin_type index to None

Source

pub fn no_account_index(&mut self) -> &mut HDPathBuilder

Set the account index to None

Source

pub fn no_change_index(&mut self) -> &mut HDPathBuilder

Set the change index to None

Source

pub fn no_address_index(&mut self) -> &mut HDPathBuilder

Set the address_index index to None

Source

pub fn build(&mut self) -> HDPath

Build the HDPath The HDPath will be built from the values specified in the builder The HDPath always starts with the Master index (m) The HDPath will go in order from purpose, coin_type, account, change, address_index

If the purpose is not set, the HDPath will return the HDPath with the Master index only If the coin_type is not set, the HDPath will return the HDPath with the Master and purpose index It will use the defaults for the account, change, and address_index unless if something else has been specified on the builder using the with or set functions. So in order to build a full HDPath going up to the address index, the purpose and coin_type must be set.

Trait Implementations§

Source§

impl Clone for HDPathBuilder

Source§

fn clone(&self) -> HDPathBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HDPathBuilder

Source§

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

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

impl Default for HDPathBuilder

Source§

fn default() -> HDPathBuilder

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

impl PartialEq for HDPathBuilder

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for HDPathBuilder

Source§

impl StructuralPartialEq for HDPathBuilder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,