pub struct ChildNumber(/* private fields */);Expand description
A child number for a derived key.
The high bit marks whether the index is hardened and the remaining bits store the actual index.
Implementations§
Source§impl ChildNumber
impl ChildNumber
Sourcepub const ZERO_NORMAL: Self
pub const ZERO_NORMAL: Self
Normal child number with index 0.
Sourcepub const ONE_NORMAL: Self
pub const ONE_NORMAL: Self
Normal child number with index 1.
Sourcepub const ZERO_HARDENED: Self
pub const ZERO_HARDENED: Self
Hardened child number with index 0.
Sourcepub const ONE_HARDENED: Self
pub const ONE_HARDENED: Self
Hardened child number with index 1.
Sourcepub fn from_normal_idx(index: u32) -> Result<Self, IndexOutOfRangeError>
pub fn from_normal_idx(index: u32) -> Result<Self, IndexOutOfRangeError>
Constructs a new normal child number from an index.
§Errors
Returns an error if the index is not within [0, 2^31 - 1].
Sourcepub fn from_hardened_idx(index: u32) -> Result<Self, IndexOutOfRangeError>
pub fn from_hardened_idx(index: u32) -> Result<Self, IndexOutOfRangeError>
Constructs a new hardened child number from an index.
§Errors
Returns an error if the index is not within [0, 2^31 - 1].
Sourcepub fn from_raw(raw: u32) -> Self
pub fn from_raw(raw: u32) -> Self
Constructs a child number from its raw BIP-0032 representation.
The raw representation includes the hardened bit. Use Self::from_normal_idx or
Self::from_hardened_idx to construct a child number from an index.
Sourcepub fn to_raw(self) -> u32
pub fn to_raw(self) -> u32
Returns the raw BIP-0032 representation.
The raw representation includes the hardened bit. Use Self::index to get the child
index without the hardened bit.
Sourcepub fn is_hardened(&self) -> bool
pub fn is_hardened(&self) -> bool
Returns true if the child number is hardened.
Sourcepub fn increment(self) -> Result<Self, IndexOutOfRangeError>
pub fn increment(self) -> Result<Self, IndexOutOfRangeError>
Returns the child number that is a single increment from this one.
§Errors
Returns an error if the index after incrementing will be outside the range [0, 2^31 - 1].
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for ChildNumber
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for ChildNumber
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl AsRef<[ChildNumber]> for ChildNumber
impl AsRef<[ChildNumber]> for ChildNumber
Source§impl Binary for ChildNumber
impl Binary for ChildNumber
Source§impl Clone for ChildNumber
impl Clone for ChildNumber
Source§fn clone(&self) -> ChildNumber
fn clone(&self) -> ChildNumber
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ChildNumber
Source§impl Debug for ChildNumber
impl Debug for ChildNumber
Source§impl<'de> Deserialize<'de> for ChildNumber
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ChildNumber
serde only.Source§fn 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>,
Source§impl Display for ChildNumber
impl Display for ChildNumber
impl Eq for ChildNumber
Source§impl From<ChildNumber> for u32
impl From<ChildNumber> for u32
Source§fn from(number: ChildNumber) -> Self
fn from(number: ChildNumber) -> Self
Source§impl From<u32> for ChildNumber
impl From<u32> for ChildNumber
Source§impl FromIterator<ChildNumber> for RelativeDerivationPath
impl FromIterator<ChildNumber> for RelativeDerivationPath
Source§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = ChildNumber>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = ChildNumber>,
Source§impl FromStr for ChildNumber
impl FromStr for ChildNumber
Source§impl Hash for ChildNumber
impl Hash for ChildNumber
Source§impl LowerHex for ChildNumber
impl LowerHex for ChildNumber
Source§impl Octal for ChildNumber
impl Octal 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 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ChildNumber
impl PartialEq for ChildNumber
Source§fn eq(&self, other: &ChildNumber) -> bool
fn eq(&self, other: &ChildNumber) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ChildNumber
impl PartialOrd for ChildNumber
Source§impl Serialize for ChildNumber
Available on crate feature serde only.
impl Serialize for ChildNumber
serde only.