pub struct DerivationPath { /* private fields */ }Expand description
BIP-32 derivation path with a stable m/… string form.
Validated and stored independently of any third-party BIP-32 crate so the
public API does not leak bip32::DerivationPath.
Implementations§
Source§impl DerivationPath
impl DerivationPath
Sourcepub fn bip_standard(
address_type: AddressType,
network: Network,
account: u32,
change: bool,
address_index: u32,
) -> Result<Self, DeriveError>
pub fn bip_standard( address_type: AddressType, network: Network, account: u32, change: bool, address_index: u32, ) -> Result<Self, DeriveError>
Standard path: m/purpose'/coin_type'/account'/change/index.
§Errors
Returns DeriveError::Path if the generated path is invalid.
Sourcepub fn from_path_str(path: &str) -> Result<Self, DeriveError>
pub fn from_path_str(path: &str) -> Result<Self, DeriveError>
Parse a BIP-32 path string.
Accepts hardened markers ' or h / H. The display form always uses
'.
§Errors
- Empty / master-only path →
DeriveError::Path - Malformed path →
DeriveError::Path
Sourcepub fn segments(&self) -> &[PathSegment]
pub fn segments(&self) -> &[PathSegment]
Borrow the path segments.
Sourcepub fn first_segment(&self) -> Option<PathSegment>
pub fn first_segment(&self) -> Option<PathSegment>
First segment, if any (used to infer BIP purpose).
Trait Implementations§
Source§impl AsRef<str> for DerivationPath
Available on crate feature alloc only.
impl AsRef<str> for DerivationPath
Available on crate feature
alloc only.Source§impl Clone for DerivationPath
impl Clone for DerivationPath
Source§fn clone(&self) -> DerivationPath
fn clone(&self) -> DerivationPath
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DerivationPath
impl Debug for DerivationPath
Source§impl Display for DerivationPath
Available on crate feature alloc only.
impl Display for DerivationPath
Available on crate feature
alloc only.impl Eq for DerivationPath
Source§impl PartialEq for DerivationPath
impl PartialEq for DerivationPath
impl StructuralPartialEq for DerivationPath
Auto Trait Implementations§
impl Freeze for DerivationPath
impl RefUnwindSafe for DerivationPath
impl Send for DerivationPath
impl Sync for DerivationPath
impl Unpin for DerivationPath
impl UnsafeUnpin for DerivationPath
impl UnwindSafe for DerivationPath
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
Mutably borrows from an owned value. Read more