pub enum ChildIndex {
Normal(u32),
Hardened(u32),
}
Expand description
An index in a DerivationPath
Variants§
Implementations§
Source§impl ChildIndex
impl ChildIndex
Sourcepub fn hardened(num: u32) -> Result<Self, ChildIndexError>
pub fn hardened(num: u32) -> Result<Self, ChildIndexError>
Create a ChildIndex::Hardened instance from a u32. This will fail if num
is not
in [0, 2^31 - 1]
Sourcepub fn normal(num: u32) -> Result<Self, ChildIndexError>
pub fn normal(num: u32) -> Result<Self, ChildIndexError>
Create a ChildIndex::Normal instance from a u32. This will fail if num
is not
in [0, 2^31 - 1]
Sourcepub fn to_u32(self) -> u32
pub fn to_u32(self) -> u32
Convert ChildIndex to its inner u32
Sourcepub fn to_bits(self) -> u32
pub fn to_bits(self) -> u32
Convert ChildIndex to a u32 representing the type and a 31 bit number. The highest bit is set for a hard derivation and clear for a normal derivation, and the remaining 31 bits are the index
Sourcepub fn from_bits(bits: u32) -> Self
pub fn from_bits(bits: u32) -> Self
Build a ChildIndex from a u32 representing the type and a 31 bit number. See ChildIndex::to_bits for more information
Sourcepub fn is_hardened(self) -> bool
pub fn is_hardened(self) -> bool
Check if the ChildIndex is “hardened”
Sourcepub fn is_normal(self) -> bool
pub fn is_normal(self) -> bool
Check if the ChildIndex is “normal”
Trait Implementations§
Source§impl Clone for ChildIndex
impl Clone for ChildIndex
Source§fn clone(&self) -> ChildIndex
fn clone(&self) -> ChildIndex
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 ChildIndex
impl Debug for ChildIndex
Source§impl Display for ChildIndex
impl Display for ChildIndex
Source§impl FromStr for ChildIndex
impl FromStr for ChildIndex
Source§impl Ord for ChildIndex
impl Ord for ChildIndex
Source§fn cmp(&self, other: &ChildIndex) -> Ordering
fn cmp(&self, other: &ChildIndex) -> 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 ChildIndex
impl PartialEq for ChildIndex
Source§impl PartialOrd for ChildIndex
impl PartialOrd for ChildIndex
impl Copy for ChildIndex
impl Eq for ChildIndex
impl StructuralPartialEq for ChildIndex
Auto Trait Implementations§
impl Freeze for ChildIndex
impl RefUnwindSafe for ChildIndex
impl Send for ChildIndex
impl Sync for ChildIndex
impl Unpin for ChildIndex
impl UnwindSafe for ChildIndex
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