Trait hdpath::HDPath

source ·
pub trait HDPath {
    // Required methods
    fn len(&self) -> u8;
    fn get(&self, pos: u8) -> Option<PathValue>;

    // Provided methods
    fn to_bytes(&self) -> Vec<u8> { ... }
    fn parent(&self) -> Option<CustomHDPath> { ... }
    fn as_custom(&self) -> CustomHDPath { ... }
}
Expand description

General trait for an HDPath. Common implementations are StandardHDPath, AccountHDPath and CustomHDPath

Required Methods§

source

fn len(&self) -> u8

Size of the HD Path

source

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.

See PathValue

Provided Methods§

source

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>

Get parent HD Path. Return None if the current path is empty (i.e. already at the top)

source

fn as_custom(&self) -> CustomHDPath

Convert current to CustomHDPath structure

Trait Implementations§

source§

impl From<&dyn HDPath> for CustomHDPath

source§

fn from(value: &dyn HDPath) -> Self

Converts to this type from the input type.

Implementors§