Struct kaspa_bip32::ChildNumber
source · pub struct ChildNumber(pub u32);
Expand description
Index of a particular child key for a given (extended) private key.
Tuple Fields§
§0: u32
Implementations§
source§impl ChildNumber
impl ChildNumber
sourcepub const HARDENED_FLAG: u32 = 2_147_483_648u32
pub const HARDENED_FLAG: u32 = 2_147_483_648u32
Hardened child keys use indices 2^31 through 2^32-1.
sourcepub fn new(index: u32, hardened: bool) -> Result<Self>
pub fn new(index: u32, hardened: bool) -> Result<Self>
Create new ChildNumber
with the given index and hardened flag.
Returns an error if it is equal to or greater than Self::HARDENED_FLAG
.
sourcepub fn from_bytes(bytes: [u8; 4]) -> Self
pub fn from_bytes(bytes: [u8; 4]) -> Self
Parse a child number from the byte encoding.
sourcepub fn index(self) -> u32
pub fn index(self) -> u32
Get the index number for this ChildNumber
, i.e. with
Self::HARDENED_FLAG
cleared.
sourcepub fn is_hardened(&self) -> bool
pub fn is_hardened(&self) -> bool
Is this child number within the hardened range?
Trait Implementations§
source§impl BorshDeserialize for ChildNumber
impl BorshDeserialize for ChildNumber
source§impl BorshSerialize for ChildNumber
impl BorshSerialize for ChildNumber
source§impl Clone for ChildNumber
impl Clone for ChildNumber
source§fn clone(&self) -> ChildNumber
fn clone(&self) -> ChildNumber
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 ChildNumber
impl Debug for ChildNumber
source§impl Default for ChildNumber
impl Default for ChildNumber
source§fn default() -> ChildNumber
fn default() -> ChildNumber
Returns the “default value” for a type. Read more
source§impl Display for ChildNumber
impl Display for ChildNumber
source§impl Extend<ChildNumber> for DerivationPath
impl Extend<ChildNumber> for DerivationPath
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = ChildNumber>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = ChildNumber>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl From<ChildNumber> for u32
impl From<ChildNumber> for u32
source§fn from(n: ChildNumber) -> u32
fn from(n: ChildNumber) -> u32
Converts to this type from the input type.
source§impl From<u32> for ChildNumber
impl From<u32> for ChildNumber
source§fn from(n: u32) -> ChildNumber
fn from(n: u32) -> ChildNumber
Converts to this type from the input type.
source§impl FromStr for ChildNumber
impl FromStr for ChildNumber
source§impl Ord for ChildNumber
impl Ord for ChildNumber
source§fn cmp(&self, other: &ChildNumber) -> Ordering
fn cmp(&self, other: &ChildNumber) -> 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 ChildNumber
impl PartialEq for ChildNumber
source§fn eq(&self, other: &ChildNumber) -> bool
fn eq(&self, other: &ChildNumber) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ChildNumber
impl PartialOrd for ChildNumber
source§fn partial_cmp(&self, other: &ChildNumber) -> Option<Ordering>
fn partial_cmp(&self, other: &ChildNumber) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ChildNumber
impl Eq for ChildNumber
impl StructuralEq for ChildNumber
impl StructuralPartialEq for ChildNumber
Auto Trait Implementations§
impl RefUnwindSafe for ChildNumber
impl Send for ChildNumber
impl Sync for ChildNumber
impl Unpin for ChildNumber
impl UnwindSafe for ChildNumber
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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