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
impl HDPathBuilder
Sourcepub fn new() -> HDPathBuilder
pub fn new() -> HDPathBuilder
Creates a new HDPathBuilder with default values
Sourcepub fn purpose_index(&mut self, purpose: u32) -> &mut HDPathBuilder
pub fn purpose_index(&mut self, purpose: u32) -> &mut HDPathBuilder
Specify the purpose index shortform number value
Sourcepub fn hardened_purpose(&mut self) -> &mut HDPathBuilder
pub fn hardened_purpose(&mut self) -> &mut HDPathBuilder
Specify that the purpose index should be hardened
Sourcepub fn non_hardened_purpose(&mut self) -> &mut HDPathBuilder
pub fn non_hardened_purpose(&mut self) -> &mut HDPathBuilder
Specify that the purpose index should not be hardened
Sourcepub fn coin_type_index(&mut self, coin_type: u32) -> &mut HDPathBuilder
pub fn coin_type_index(&mut self, coin_type: u32) -> &mut HDPathBuilder
Specify the coin_type index shortform number value
Sourcepub fn hardened_coin_type(&mut self) -> &mut HDPathBuilder
pub fn hardened_coin_type(&mut self) -> &mut HDPathBuilder
Specify that the coin type index should be hardened
Sourcepub fn non_hardened_coin_type(&mut self) -> &mut HDPathBuilder
pub fn non_hardened_coin_type(&mut self) -> &mut HDPathBuilder
Specify that the coin type index should not be hardened
Sourcepub fn account_index(&mut self, account: u32) -> &mut HDPathBuilder
pub fn account_index(&mut self, account: u32) -> &mut HDPathBuilder
Specify the account index shortform number value
Sourcepub fn hardened_account(&mut self) -> &mut HDPathBuilder
pub fn hardened_account(&mut self) -> &mut HDPathBuilder
Specify that the account index should be hardened
Sourcepub fn non_hardened_account(&mut self) -> &mut HDPathBuilder
pub fn non_hardened_account(&mut self) -> &mut HDPathBuilder
Specify that the account index should not be hardened
Sourcepub fn change_index(&mut self, change: u32) -> &mut HDPathBuilder
pub fn change_index(&mut self, change: u32) -> &mut HDPathBuilder
Specify the change index shortform number value
Sourcepub fn hardened_change(&mut self) -> &mut HDPathBuilder
pub fn hardened_change(&mut self) -> &mut HDPathBuilder
Specify that the change index should be hardened
Sourcepub fn non_hardened_change(&mut self) -> &mut HDPathBuilder
pub fn non_hardened_change(&mut self) -> &mut HDPathBuilder
Specify that the change index should not be hardened
Sourcepub fn address_index(&mut self, address_index: u32) -> &mut HDPathBuilder
pub fn address_index(&mut self, address_index: u32) -> &mut HDPathBuilder
Specify the address_index index shortform number value
Sourcepub fn hardened_address(&mut self) -> &mut HDPathBuilder
pub fn hardened_address(&mut self) -> &mut HDPathBuilder
Specify that the address index should be hardened
Sourcepub fn non_hardened_address(&mut self) -> &mut HDPathBuilder
pub fn non_hardened_address(&mut self) -> &mut HDPathBuilder
Specify that the address index should not be hardened
Sourcepub fn no_purpose_index(&mut self) -> &mut HDPathBuilder
pub fn no_purpose_index(&mut self) -> &mut HDPathBuilder
Set the purpose index to None
Sourcepub fn no_coin_type_index(&mut self) -> &mut HDPathBuilder
pub fn no_coin_type_index(&mut self) -> &mut HDPathBuilder
Set the coin_type index to None
Sourcepub fn no_account_index(&mut self) -> &mut HDPathBuilder
pub fn no_account_index(&mut self) -> &mut HDPathBuilder
Set the account index to None
Sourcepub fn no_change_index(&mut self) -> &mut HDPathBuilder
pub fn no_change_index(&mut self) -> &mut HDPathBuilder
Set the change index to None
Sourcepub fn no_address_index(&mut self) -> &mut HDPathBuilder
pub fn no_address_index(&mut self) -> &mut HDPathBuilder
Set the address_index index to None
Sourcepub fn build(&mut self) -> HDPath
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
impl Clone for HDPathBuilder
Source§fn clone(&self) -> HDPathBuilder
fn clone(&self) -> HDPathBuilder
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HDPathBuilder
impl Debug for HDPathBuilder
Source§impl Default for HDPathBuilder
impl Default for HDPathBuilder
Source§fn default() -> HDPathBuilder
fn default() -> HDPathBuilder
Source§impl PartialEq for HDPathBuilder
impl PartialEq for HDPathBuilder
impl Eq for HDPathBuilder
impl StructuralPartialEq for HDPathBuilder
Auto Trait Implementations§
impl Freeze for HDPathBuilder
impl RefUnwindSafe for HDPathBuilder
impl Send for HDPathBuilder
impl Sync for HDPathBuilder
impl Unpin for HDPathBuilder
impl UnwindSafe for HDPathBuilder
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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