pub enum DerivationIndex {
Normal(NormalIndex),
Hardened(HardenedIndex),
}
Variants§
Normal(NormalIndex)
Hardened(HardenedIndex)
Implementations§
Source§impl DerivationIndex
impl DerivationIndex
pub const fn normal(child_number: u16) -> DerivationIndex
pub const fn hardened(child_number: u16) -> DerivationIndex
pub const fn from_index(value: u32) -> DerivationIndex
Trait Implementations§
Source§impl Clone for DerivationIndex
impl Clone for DerivationIndex
Source§fn clone(&self) -> DerivationIndex
fn clone(&self) -> DerivationIndex
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 DerivationIndex
impl Debug for DerivationIndex
Source§impl Display for DerivationIndex
impl Display for DerivationIndex
Source§impl From<HardenedIndex> for DerivationIndex
impl From<HardenedIndex> for DerivationIndex
Source§fn from(v: HardenedIndex) -> DerivationIndex
fn from(v: HardenedIndex) -> DerivationIndex
Converts to this type from the input type.
Source§impl From<Keychain> for DerivationIndex
impl From<Keychain> for DerivationIndex
Source§fn from(keychain: Keychain) -> DerivationIndex
fn from(keychain: Keychain) -> DerivationIndex
Converts to this type from the input type.
Source§impl From<NormalIndex> for DerivationIndex
impl From<NormalIndex> for DerivationIndex
Source§fn from(v: NormalIndex) -> DerivationIndex
fn from(v: NormalIndex) -> DerivationIndex
Converts to this type from the input type.
Source§impl From<u32> for DerivationIndex
impl From<u32> for DerivationIndex
Source§fn from(value: u32) -> DerivationIndex
fn from(value: u32) -> DerivationIndex
Converts to this type from the input type.
Source§impl FromStr for DerivationIndex
impl FromStr for DerivationIndex
Source§type Err = IndexParseError
type Err = IndexParseError
The associated error which can be returned from parsing.
Source§fn from_str(
s: &str,
) -> Result<DerivationIndex, <DerivationIndex as FromStr>::Err>
fn from_str( s: &str, ) -> Result<DerivationIndex, <DerivationIndex as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moreSource§impl Hash for DerivationIndex
impl Hash for DerivationIndex
Source§impl Idx for DerivationIndex
impl Idx for DerivationIndex
Source§const ZERO: DerivationIndex
const ZERO: DerivationIndex
Derivation path segment with index equal to zero.
Source§const ONE: DerivationIndex
const ONE: DerivationIndex
Derivation path segment with index equal to one.
Source§const MAX: DerivationIndex
const MAX: DerivationIndex
Derivation path segment with index equal to maximum value.
Source§fn try_from_index(index: u32) -> Result<DerivationIndex, IndexError>
fn try_from_index(index: u32) -> Result<DerivationIndex, IndexError>
Constructs derivation path segment with specific derivation value, which
for normal indexes must lie in range
0..
HARDENED_INDEX_BOUNDARY
and for hardened in range of HARDENED_INDEX_BOUNDARY
..=u32::MAX
Source§fn checked_add_assign(&mut self, add: impl Into<u32>) -> Option<DerivationIndex>
fn checked_add_assign(&mut self, add: impl Into<u32>) -> Option<DerivationIndex>
Mutates the self by adding value the index; fails if the index value
overflow happens.
Source§fn checked_sub_assign(&mut self, sub: impl Into<u32>) -> Option<DerivationIndex>
fn checked_sub_assign(&mut self, sub: impl Into<u32>) -> Option<DerivationIndex>
Mutates the self by subtracting value the index; fails if the index
value overflow happens.
Source§fn from_child_number(child_no: impl Into<u16>) -> Self
fn from_child_number(child_no: impl Into<u16>) -> Self
Constructs index from a given child number. Read more
Source§fn try_from_child_number(child_no: impl Into<u32>) -> Result<Self, IndexError>
fn try_from_child_number(child_no: impl Into<u32>) -> Result<Self, IndexError>
Constructs index from a given child number. Read more
fn to_be_bytes(&self) -> [u8; 4]
Source§fn checked_inc(&self) -> Option<Self>
fn checked_inc(&self) -> Option<Self>
Increments the index on one step; fails if the index value is already
maximum value.
Source§fn checked_dec(&self) -> Option<Self>
fn checked_dec(&self) -> Option<Self>
Decrements the index on one step; fails if the index value is already
minimum value.
Source§fn saturating_inc(&self) -> Self
fn saturating_inc(&self) -> Self
Increments the index on one step saturating at the
Self::MAX
bounds
instead of overflowing.Source§fn saturating_dec(&self) -> Self
fn saturating_dec(&self) -> Self
Decrements the index on one step saturating at the
Self::MIN
bounds
instead of overflowing.Source§fn wrapping_inc(&self) -> Self
fn wrapping_inc(&self) -> Self
Increments the index on one step; fails if the index value is already
maximum value.
Source§fn wrapping_dec(&self) -> Self
fn wrapping_dec(&self) -> Self
Decrements the index on one step; fails if the index value is already
minimum value.
Source§fn checked_inc_assign(&mut self) -> Option<Self>
fn checked_inc_assign(&mut self) -> Option<Self>
Mutates the self by incrementing the index on one step; fails if the index
value is already maximum value.
Source§fn checked_dec_assign(&mut self) -> Option<Self>
fn checked_dec_assign(&mut self) -> Option<Self>
Mutates the self by decrementing the index on one step; fails if the index
value is already maximum value.
Source§fn saturating_inc_assign(&mut self) -> bool
fn saturating_inc_assign(&mut self) -> bool
Mutates the self by incrementing the index on one step, saturating at the
Self::MAX
bounds instead of overflowing.Source§fn saturating_dec_assign(&mut self) -> bool
fn saturating_dec_assign(&mut self) -> bool
Mutates the self by decrementing the index on one step, saturating at the
Self::MIN
bounds instead of overflowing.Source§fn wrapping_inc_assign(&mut self)
fn wrapping_inc_assign(&mut self)
Mutates the self by incrementing the index on one step; fails if the index
value is already maximum value.
Source§fn wrapping_dec_assign(&mut self)
fn wrapping_dec_assign(&mut self)
Mutates the self by decrementing the index on one step; fails if the index
value is already maximum value.
Source§fn checked_add(&self, add: impl Into<u32>) -> Option<Self>
fn checked_add(&self, add: impl Into<u32>) -> Option<Self>
Adds value the index; fails if the index value overflow happens.
Source§fn checked_sub(&self, sub: impl Into<u32>) -> Option<Self>
fn checked_sub(&self, sub: impl Into<u32>) -> Option<Self>
Subtracts value the index; fails if the index value overflow happens.
Source§fn saturating_add(&self, add: impl Into<u32>) -> Self
fn saturating_add(&self, add: impl Into<u32>) -> Self
Saturating index addition. Computes
self + add
, saturating at the
Self::MAX
bounds instead of overflowing.Source§fn saturating_sub(&self, sub: impl Into<u32>) -> Self
fn saturating_sub(&self, sub: impl Into<u32>) -> Self
Saturating index subtraction. Computes
self - add
, saturating at
the Self::MIN
bounds instead of overflowing.Source§impl IdxBase for DerivationIndex
impl IdxBase for DerivationIndex
Source§fn child_number(&self) -> u32
fn child_number(&self) -> u32
Returns child number corresponding to this index. Read more
Source§fn index(&self) -> u32
fn index(&self) -> u32
Returns value used during derivation, which for normal indexes must lie
in range
0..
HARDENED_INDEX_BOUNDARY
and for hardened in range
of HARDENED_INDEX_BOUNDARY
..=u32::MAX
Source§fn is_hardened(&self) -> bool
fn is_hardened(&self) -> bool
Detects whether path segment uses hardened index(es)
Source§impl Ord for DerivationIndex
impl Ord for DerivationIndex
Source§fn cmp(&self, other: &DerivationIndex) -> Ordering
fn cmp(&self, other: &DerivationIndex) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DerivationIndex
impl PartialEq for DerivationIndex
Source§impl PartialOrd for DerivationIndex
impl PartialOrd for DerivationIndex
Source§impl TryFrom<DerivationIndex> for HardenedIndex
impl TryFrom<DerivationIndex> for HardenedIndex
Source§type Error = IndexError
type Error = IndexError
The type returned in the event of a conversion error.
Source§fn try_from(
idx: DerivationIndex,
) -> Result<HardenedIndex, <HardenedIndex as TryFrom<DerivationIndex>>::Error>
fn try_from( idx: DerivationIndex, ) -> Result<HardenedIndex, <HardenedIndex as TryFrom<DerivationIndex>>::Error>
Performs the conversion.
Source§impl TryFrom<DerivationIndex> for NormalIndex
impl TryFrom<DerivationIndex> for NormalIndex
Source§type Error = IndexError
type Error = IndexError
The type returned in the event of a conversion error.
Source§fn try_from(
idx: DerivationIndex,
) -> Result<NormalIndex, <NormalIndex as TryFrom<DerivationIndex>>::Error>
fn try_from( idx: DerivationIndex, ) -> Result<NormalIndex, <NormalIndex as TryFrom<DerivationIndex>>::Error>
Performs the conversion.
impl Copy for DerivationIndex
impl Eq for DerivationIndex
impl StructuralPartialEq for DerivationIndex
Auto Trait Implementations§
impl Freeze for DerivationIndex
impl RefUnwindSafe for DerivationIndex
impl Send for DerivationIndex
impl Sync for DerivationIndex
impl Unpin for DerivationIndex
impl UnwindSafe for DerivationIndex
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.