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
sourceimpl KeyDerivation
impl KeyDerivation
sourcepub fn same_root(&self, other: &Self) -> bool
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.
sourcepub fn is_possible_ancestor_of(&self, other: &Self) -> bool
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.
sourcepub fn path_to_descendant(&self, descendant: &Self) -> Option<DerivationPath>
pub fn path_to_descendant(&self, descendant: &Self) -> Option<DerivationPath>
Returns the path to the decendant.
Trait Implementations
sourceimpl ByteFormat for KeyDerivation
impl ByteFormat for KeyDerivation
type Error = Bip32Error
type Error = Bip32Error
An associated error type
sourcefn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the byte-length of the serialized data structure.
sourcefn read_from<T>(_reader: &mut T) -> Result<Self, Self::Error> where
T: Read,
Self: Sized,
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
sourcefn write_to<T>(&self, writer: &mut T) -> Result<usize, Self::Error> where
T: Write,
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
sourcefn read_seq_from<R>(
reader: &mut R,
mode: ReadSeqMode
) -> Result<Vec<Self, Global>, Self::Error> where
R: Read,
fn read_seq_from<R>(
reader: &mut R,
mode: ReadSeqMode
) -> Result<Vec<Self, Global>, Self::Error> where
R: Read,
Read a sequence of exactly limit
objects from the reader.
sourcefn 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>,
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
sourcefn deserialize_hex(s: &str) -> Result<Self, Self::Error>
fn deserialize_hex(s: &str) -> Result<Self, Self::Error>
Decodes a hex string to a Vec<u8>
, deserializes an instance of Self
from that vector.
sourcefn deserialize_base64(s: &str) -> Result<Self, Self::Error>
fn deserialize_base64(s: &str) -> Result<Self, Self::Error>
Serialize self
to a base64 string, using standard RFC4648 non-url safe characters
sourcefn serialize_hex(&self) -> String
fn serialize_hex(&self) -> String
Serializes self
to a vector, returns the hex-encoded vector
sourcefn serialize_base64(&self) -> String
fn serialize_base64(&self) -> String
Serialize self
to a base64 string, using standard RFC4648 non-url safe characters
sourceimpl Clone for KeyDerivation
impl Clone for KeyDerivation
sourcefn clone(&self) -> KeyDerivation
fn clone(&self) -> KeyDerivation
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for KeyDerivation
impl Debug for KeyDerivation
sourceimpl<'de> Deserialize<'de> for KeyDerivation
impl<'de> Deserialize<'de> for KeyDerivation
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<KeyDerivation> for KeyDerivation
impl PartialEq<KeyDerivation> for KeyDerivation
sourcefn eq(&self, other: &KeyDerivation) -> bool
fn eq(&self, other: &KeyDerivation) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &KeyDerivation) -> bool
fn ne(&self, other: &KeyDerivation) -> bool
This method tests for !=
.
sourceimpl Serialize for KeyDerivation
impl Serialize for KeyDerivation
impl Eq for KeyDerivation
impl StructuralEq for KeyDerivation
impl StructuralPartialEq for KeyDerivation
Auto Trait Implementations
impl RefUnwindSafe for KeyDerivation
impl Send for KeyDerivation
impl Sync for KeyDerivation
impl Unpin for KeyDerivation
impl UnwindSafe for KeyDerivation
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more