Struct hdpath::CustomHDPath
source · pub struct CustomHDPath(pub Vec<PathValue>);
Expand description
A custom HD Path, that can be any length and contain any Hardened and non-Hardened values in any order. Direct implementation for BIP-32
If you need just standard type of HD Path like m/44'/0'/0'/0/0
use StandardHDPath
instead.
Usage
Parse string
use hdpath::CustomHDPath;
let hdpath = CustomHDPath::try_from("m/1'/2'/3/4/5'/6'/7").unwrap();
let hdpath = CustomHDPath::try_from("m/44'/0'/1'/0/0").unwrap();
//also support uppercase notation
let hdpath = CustomHDPath::try_from("M/44H/0H/1H/0/0").unwrap();
Direct create
use hdpath::{CustomHDPath, PathValue};
let hdpath = CustomHDPath::try_new(vec![
PathValue::hardened(44), PathValue::hardened(0), PathValue::hardened(1),
PathValue::normal(0), PathValue::normal(0)
]).unwrap();
Tuple Fields§
§0: Vec<PathValue>
Implementations§
source§impl CustomHDPath
impl CustomHDPath
Trait Implementations§
source§impl Clone for CustomHDPath
impl Clone for CustomHDPath
source§fn clone(&self) -> CustomHDPath
fn clone(&self) -> CustomHDPath
Returns a copy of the value. Read more
1.0.0 · 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 CustomHDPath
impl Debug for CustomHDPath
source§impl Display for CustomHDPath
impl Display for CustomHDPath
source§impl From<&dyn HDPath> for CustomHDPath
impl From<&dyn HDPath> for CustomHDPath
source§impl From<StandardHDPath> for CustomHDPath
impl From<StandardHDPath> for CustomHDPath
source§fn from(value: StandardHDPath) -> Self
fn from(value: StandardHDPath) -> Self
Converts to this type from the input type.
source§impl FromStr for CustomHDPath
impl FromStr for CustomHDPath
source§impl HDPath for CustomHDPath
impl HDPath for CustomHDPath
source§fn get(&self, pos: u8) -> Option<PathValue>
fn get(&self, pos: u8) -> Option<PathValue>
Get element as the specified position.
The implementation must return
Some<PathValue>
for all values up to len()
.
And return None
if the position if out of bounds. Read moresource§fn to_bytes(&self) -> Vec<u8>
fn to_bytes(&self) -> Vec<u8>
Encode as bytes, where first byte is number of elements in path (always 5 for StandardHDPath)
following by 4-byte BE values
source§fn parent(&self) -> Option<CustomHDPath>
fn parent(&self) -> Option<CustomHDPath>
Get parent HD Path.
Return
None
if the current path is empty (i.e. already at the top)source§fn as_custom(&self) -> CustomHDPath
fn as_custom(&self) -> CustomHDPath
Convert current to
CustomHDPath
structuresource§impl Hash for CustomHDPath
impl Hash for CustomHDPath
source§impl PartialEq<CustomHDPath> for CustomHDPath
impl PartialEq<CustomHDPath> for CustomHDPath
source§fn eq(&self, other: &CustomHDPath) -> bool
fn eq(&self, other: &CustomHDPath) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<&str> for CustomHDPath
impl TryFrom<&str> for CustomHDPath
source§impl TryFrom<CustomHDPath> for AccountHDPath
impl TryFrom<CustomHDPath> for AccountHDPath
source§impl TryFrom<CustomHDPath> for StandardHDPath
impl TryFrom<CustomHDPath> for StandardHDPath
impl Eq for CustomHDPath
impl StructuralEq for CustomHDPath
impl StructuralPartialEq for CustomHDPath
Auto Trait Implementations§
impl RefUnwindSafe for CustomHDPath
impl Send for CustomHDPath
impl Sync for CustomHDPath
impl Unpin for CustomHDPath
impl UnwindSafe for CustomHDPath
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