Struct coins_bip32::path::KeyDerivation

source ·
pub struct KeyDerivation {
    pub root: KeyFingerprint,
    pub path: DerivationPath,
}
Expand description

A Derivation Path for a bip32 key

Fields§

§root: KeyFingerprint

The root key fingerprint

§path: DerivationPath

The derivation path from the root key

Implementations§

source§

impl KeyDerivation

source

pub fn same_root(&self, other: &Self) -> bool

true if the keys share a root fingerprint, false otherwise. Note that on key fingerprints, which may collide accidentally, or be intentionally collided.

source

pub fn is_possible_ancestor_of(&self, other: &Self) -> bool

true if this key is an ancestor of other, false otherwise. Note that on key fingerprints, which may collide accidentally, or be intentionally collided.

source

pub fn path_to_descendant(&self, descendant: &Self) -> Option<DerivationPath>

Returns the path to the decendant.

source

pub fn resized(&self, size: usize, pad_with: u32) -> Self

Return a clone with a resized path. If the new size is shorter, this truncates it. If the new path is longer, we pad with the second argument.

source

pub fn extended(&self, idx: u32) -> Self

Append an additional derivation to the end, return a clone

Trait Implementations§

source§

impl ByteFormat for KeyDerivation

§

type Error = Bip32Error

An associated error type
source§

fn serialized_length(&self) -> usize

Returns the byte-length of the serialized data structure.
source§

fn read_from<T>(_reader: &mut T) -> Result<Self, Self::Error>
where T: Read, Self: Sized,

Deserializes an instance of Self from a std::io::Read. The limit argument is used only when deserializing collections, and specifies a maximum number of instances of the underlying type to read. Read more
source§

fn write_to<T>(&self, writer: &mut T) -> Result<usize, Self::Error>
where T: Write,

Serializes self to a std::io::Write. Following Write trait conventions, its Ok type must be a usize denoting the number of bytes written. Read more
source§

fn read_seq_from<R>( reader: &mut R, mode: ReadSeqMode, ) -> Result<Vec<Self>, Self::Error>
where R: Read, Self: Sized,

Read a sequence of objects from the reader. The mode argument specifies how many objects to read.
source§

fn write_seq_to<'a, W, E, Iter, Item>( writer: &mut W, iter: Iter, ) -> Result<usize, Self::Error>
where W: Write, E: Into<Self::Error> + From<SerError> + From<Error> + Error, Item: 'a + ByteFormat<Error = E>, Iter: IntoIterator<Item = &'a Item>,

Write a sequence of ByteFormat objects to a writer. The iter argument may be any object that implements IntoIterator<Item = &Item>. This means we can seamlessly use vectors, slices, etc. Read more
source§

fn deserialize_hex(s: &str) -> Result<Self, Self::Error>
where Self: Sized,

Decodes a hex string to a Vec<u8>, deserializes an instance of Self from that vector.
source§

fn deserialize_base64(s: &str) -> Result<Self, Self::Error>
where Self: Sized,

Serialize self to a base64 string, using standard RFC4648 non-url safe characters
source§

fn serialize_hex(&self) -> String

Serializes self to a vector, returns the hex-encoded vector
source§

fn serialize_base64(&self) -> String

Serialize self to a base64 string, using standard RFC4648 non-url safe characters
source§

impl Clone for KeyDerivation

source§

fn clone(&self) -> KeyDerivation

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for KeyDerivation

source§

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

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

impl<'de> Deserialize<'de> for KeyDerivation

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for KeyDerivation

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for KeyDerivation

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for KeyDerivation

source§

impl StructuralPartialEq for KeyDerivation

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,