What changed, and why it matters
This commit is a simple rename of an internal Rust module from `parse` to `parse_int`. It does not change what the code does, only how it is named and where it appears in the public API. There is no security fix or behavior change.
No security action needed. Treat as a normal API naming change; downstream users may need to update import paths if they used the old module name.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change renames bitcoin_units::parse to bitcoin_units::parse_int across the units, primitives, and bitcoin crates, updating all imports, re-exports, and generated API snapshot files. The parsing logic, error types, and trait implementations remain identical; only the module path changed. This is a pure refactoring/cleanup commit.
Changed components
bitcoin_units::parse_int module (formerly bitcoin_units::parse)primitives crate re-exportsbitcoin crate re-exportsgenerated API snapshot filesInspect captured patch +1016 / −1026
diff --git a/api/units/all-features.txt b/api/units/all-features.txt
index dc1ffb83..dc072bfe 100644
--- a/api/units/all-features.txt
+++ b/api/units/all-features.txt
@@ -10,7 +10,7 @@
#[non_exhaustive] pub struct bitcoin_units::fee_rate::serde::OverflowError
#[non_exhaustive] pub struct bitcoin_units::locktime::absolute::ConversionError
#[non_exhaustive] pub struct bitcoin_units::locktime::absolute::error::ConversionError
-#[non_exhaustive] pub struct bitcoin_units::parse::ParseIntError
+#[non_exhaustive] pub struct bitcoin_units::parse_int::ParseIntError
#[non_exhaustive] pub struct bitcoin_units::result::NumOpError(_)
impl bitcoin_units::Amount
impl bitcoin_units::BlockTime
@@ -33,16 +33,16 @@ impl bitcoin_units::locktime::relative::LockTime
impl bitcoin_units::locktime::relative::NumberOf512Seconds
impl bitcoin_units::locktime::relative::NumberOfBlocks
impl bitcoin_units::locktime::relative::error::DisabledLockTimeError
-impl bitcoin_units::parse::Integer for i128
-impl bitcoin_units::parse::Integer for i16
-impl bitcoin_units::parse::Integer for i32
-impl bitcoin_units::parse::Integer for i64
-impl bitcoin_units::parse::Integer for i8
-impl bitcoin_units::parse::Integer for u128
-impl bitcoin_units::parse::Integer for u16
-impl bitcoin_units::parse::Integer for u32
-impl bitcoin_units::parse::Integer for u64
-impl bitcoin_units::parse::Integer for u8
+impl bitcoin_units::parse_int::Integer for i128
+impl bitcoin_units::parse_int::Integer for i16
+impl bitcoin_units::parse_int::Integer for i32
+impl bitcoin_units::parse_int::Integer for i64
+impl bitcoin_units::parse_int::Integer for i8
+impl bitcoin_units::parse_int::Integer for u128
+impl bitcoin_units::parse_int::Integer for u16
+impl bitcoin_units::parse_int::Integer for u32
+impl bitcoin_units::parse_int::Integer for u64
+impl bitcoin_units::parse_int::Integer for u8
impl bitcoin_units::result::MathOp
impl bitcoin_units::result::NumOpError
impl bitcoin_units::sequence::Sequence
@@ -88,9 +88,9 @@ impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::clone::Clone for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::clone::Clone for bitcoin_units::parse::ParseIntError
-impl core::clone::Clone for bitcoin_units::parse::PrefixedHexError
-impl core::clone::Clone for bitcoin_units::parse::UnprefixedHexError
+impl core::clone::Clone for bitcoin_units::parse_int::ParseIntError
+impl core::clone::Clone for bitcoin_units::parse_int::PrefixedHexError
+impl core::clone::Clone for bitcoin_units::parse_int::UnprefixedHexError
impl core::clone::Clone for bitcoin_units::result::MathOp
impl core::clone::Clone for bitcoin_units::result::NumOpError
impl core::clone::Clone for bitcoin_units::sequence::Sequence
@@ -135,9 +135,9 @@ impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByEr
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::cmp::Eq for bitcoin_units::parse::ParseIntError
-impl core::cmp::Eq for bitcoin_units::parse::PrefixedHexError
-impl core::cmp::Eq for bitcoin_units::parse::UnprefixedHexError
+impl core::cmp::Eq for bitcoin_units::parse_int::ParseIntError
+impl core::cmp::Eq for bitcoin_units::parse_int::PrefixedHexError
+impl core::cmp::Eq for bitcoin_units::parse_int::UnprefixedHexError
impl core::cmp::Eq for bitcoin_units::result::MathOp
impl core::cmp::Eq for bitcoin_units::result::NumOpError
impl core::cmp::Eq for bitcoin_units::sequence::Sequence
@@ -196,9 +196,9 @@ impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisf
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::cmp::PartialEq for bitcoin_units::parse::ParseIntError
-impl core::cmp::PartialEq for bitcoin_units::parse::PrefixedHexError
-impl core::cmp::PartialEq for bitcoin_units::parse::UnprefixedHexError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::ParseIntError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::PrefixedHexError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::UnprefixedHexError
impl core::cmp::PartialEq for bitcoin_units::result::MathOp
impl core::cmp::PartialEq for bitcoin_units::result::NumOpError
impl core::cmp::PartialEq for bitcoin_units::sequence::Sequence
@@ -216,7 +216,7 @@ impl core::cmp::PartialOrd for bitcoin_units::locktime::absolute::MedianTimePast
impl core::cmp::PartialOrd for bitcoin_units::locktime::relative::NumberOf512Seconds
impl core::cmp::PartialOrd for bitcoin_units::locktime::relative::NumberOfBlocks
impl core::cmp::PartialOrd for bitcoin_units::sequence::Sequence
-impl core::convert::AsRef<core::num::error::ParseIntError> for bitcoin_units::parse::ParseIntError
+impl core::convert::AsRef<core::num::error::ParseIntError> for bitcoin_units::parse_int::ParseIntError
impl core::convert::From<&bitcoin_units::Amount> for bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
impl core::convert::From<&bitcoin_units::SignedAmount> for bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
impl core::convert::From<bitcoin_units::Amount> for bitcoin_units::SignedAmount
@@ -249,16 +249,16 @@ impl core::convert::From<bitcoin_units::locktime::relative::NumberOf512Seconds>
impl core::convert::From<bitcoin_units::locktime::relative::NumberOf512Seconds> for bitcoin_units::locktime::relative::LockTime
impl core::convert::From<bitcoin_units::locktime::relative::NumberOfBlocks> for bitcoin_units::block::BlockHeightInterval
impl core::convert::From<bitcoin_units::locktime::relative::NumberOfBlocks> for bitcoin_units::locktime::relative::LockTime
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for bitcoin_units::parse::PrefixedHexError
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for bitcoin_units::parse::UnprefixedHexError
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for core::num::error::ParseIntError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for bitcoin_units::parse_int::PrefixedHexError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for bitcoin_units::parse_int::UnprefixedHexError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for core::num::error::ParseIntError
impl core::convert::From<bitcoin_units::sequence::Sequence> for u32
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseAmountError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseDenominationError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::fee_rate::serde::OverflowError
-impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse::PrefixedHexError
-impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse::UnprefixedHexError
+impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse_int::PrefixedHexError
+impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse_int::UnprefixedHexError
impl core::convert::From<u16> for bitcoin_units::locktime::relative::NumberOfBlocks
impl core::convert::From<u32> for bitcoin_units::BlockTime
impl core::convert::From<u32> for bitcoin_units::block::BlockHeight
@@ -334,9 +334,9 @@ impl core::error::Error for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::error::Error for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::error::Error for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::error::Error for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::error::Error for bitcoin_units::parse::ParseIntError
-impl core::error::Error for bitcoin_units::parse::PrefixedHexError
-impl core::error::Error for bitcoin_units::parse::UnprefixedHexError
+impl core::error::Error for bitcoin_units::parse_int::ParseIntError
+impl core::error::Error for bitcoin_units::parse_int::PrefixedHexError
+impl core::error::Error for bitcoin_units::parse_int::UnprefixedHexError
impl core::error::Error for bitcoin_units::result::NumOpError
impl core::fmt::Debug for bitcoin_units::Amount
impl core::fmt::Debug for bitcoin_units::BlockTime
@@ -380,9 +380,9 @@ impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedB
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::fmt::Debug for bitcoin_units::parse::ParseIntError
-impl core::fmt::Debug for bitcoin_units::parse::PrefixedHexError
-impl core::fmt::Debug for bitcoin_units::parse::UnprefixedHexError
+impl core::fmt::Debug for bitcoin_units::parse_int::ParseIntError
+impl core::fmt::Debug for bitcoin_units::parse_int::PrefixedHexError
+impl core::fmt::Debug for bitcoin_units::parse_int::UnprefixedHexError
impl core::fmt::Debug for bitcoin_units::result::MathOp
impl core::fmt::Debug for bitcoin_units::result::NumOpError
impl core::fmt::Debug for bitcoin_units::sequence::Sequence
@@ -425,9 +425,9 @@ impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::fmt::Display for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::fmt::Display for bitcoin_units::parse::ParseIntError
-impl core::fmt::Display for bitcoin_units::parse::PrefixedHexError
-impl core::fmt::Display for bitcoin_units::parse::UnprefixedHexError
+impl core::fmt::Display for bitcoin_units::parse_int::ParseIntError
+impl core::fmt::Display for bitcoin_units::parse_int::PrefixedHexError
+impl core::fmt::Display for bitcoin_units::parse_int::UnprefixedHexError
impl core::fmt::Display for bitcoin_units::result::MathOp
impl core::fmt::Display for bitcoin_units::result::NumOpError
impl core::fmt::Display for bitcoin_units::sequence::Sequence
@@ -518,9 +518,9 @@ impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisf
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Freeze for bitcoin_units::parse::ParseIntError
-impl core::marker::Freeze for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Freeze for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Freeze for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Freeze for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Freeze for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Freeze for bitcoin_units::result::MathOp
impl core::marker::Freeze for bitcoin_units::result::NumOpError
impl core::marker::Freeze for bitcoin_units::sequence::Sequence
@@ -566,9 +566,9 @@ impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Send for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Send for bitcoin_units::parse::ParseIntError
-impl core::marker::Send for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Send for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Send for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Send for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Send for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Send for bitcoin_units::result::MathOp
impl core::marker::Send for bitcoin_units::result::NumOpError
impl core::marker::Send for bitcoin_units::sequence::Sequence
@@ -613,9 +613,9 @@ impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::er
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::ParseIntError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::PrefixedHexError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::ParseIntError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::StructuralPartialEq for bitcoin_units::result::MathOp
impl core::marker::StructuralPartialEq for bitcoin_units::result::NumOpError
impl core::marker::StructuralPartialEq for bitcoin_units::sequence::Sequence
@@ -661,9 +661,9 @@ impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Sync for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Sync for bitcoin_units::parse::ParseIntError
-impl core::marker::Sync for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Sync for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Sync for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Sync for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Sync for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Sync for bitcoin_units::result::MathOp
impl core::marker::Sync for bitcoin_units::result::NumOpError
impl core::marker::Sync for bitcoin_units::sequence::Sequence
@@ -709,9 +709,9 @@ impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfi
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Unpin for bitcoin_units::parse::ParseIntError
-impl core::marker::Unpin for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Unpin for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Unpin for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Unpin for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Unpin for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Unpin for bitcoin_units::result::MathOp
impl core::marker::Unpin for bitcoin_units::result::NumOpError
impl core::marker::Unpin for bitcoin_units::sequence::Sequence
@@ -983,9 +983,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relati
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::ParseIntError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::PrefixedHexError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::UnprefixedHexError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::ParseIntError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::PrefixedHexError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::UnprefixedHexError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::result::MathOp
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::result::NumOpError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::sequence::Sequence
@@ -1031,9 +1031,9 @@ impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative:
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::ParseIntError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::PrefixedHexError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::UnprefixedHexError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::ParseIntError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::PrefixedHexError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::UnprefixedHexError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::result::MathOp
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::result::NumOpError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::sequence::Sequence
@@ -1956,10 +1956,10 @@ pub fn bitcoin_units::locktime::absolute::LockTime::from(h: bitcoin_units::lockt
pub fn bitcoin_units::locktime::absolute::LockTime::from(t: bitcoin_units::locktime::absolute::MedianTimePast) -> Self
pub fn bitcoin_units::locktime::absolute::LockTime::from_consensus(n: u32) -> Self
pub fn bitcoin_units::locktime::absolute::LockTime::from_height(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
-pub fn bitcoin_units::locktime::absolute::LockTime::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::PrefixedHexError>
+pub fn bitcoin_units::locktime::absolute::LockTime::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::PrefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::from_mtp(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub fn bitcoin_units::locktime::absolute::LockTime::from_str(s: &str) -> core::result::Result<Self, Self::Err>
-pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::UnprefixedHexError>
+pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
@@ -2078,36 +2078,36 @@ pub fn bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError::source(
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::clone(&self) -> bitcoin_units::locktime::relative::error::TimeOverflowError
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::eq(&self, other: &bitcoin_units::locktime::relative::error::TimeOverflowError) -> bool
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::ParseIntError::as_ref(&self) -> &core::num::error::ParseIntError
-pub fn bitcoin_units::parse::ParseIntError::clone(&self) -> bitcoin_units::parse::ParseIntError
-pub fn bitcoin_units::parse::ParseIntError::eq(&self, other: &bitcoin_units::parse::ParseIntError) -> bool
-pub fn bitcoin_units::parse::ParseIntError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::ParseIntError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-pub fn bitcoin_units::parse::PrefixedHexError::clone(&self) -> bitcoin_units::parse::PrefixedHexError
-pub fn bitcoin_units::parse::PrefixedHexError::eq(&self, other: &bitcoin_units::parse::PrefixedHexError) -> bool
-pub fn bitcoin_units::parse::PrefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::PrefixedHexError::from(e: bitcoin_units::parse::ParseIntError) -> Self
-pub fn bitcoin_units::parse::PrefixedHexError::from(never: core::convert::Infallible) -> Self
-pub fn bitcoin_units::parse::PrefixedHexError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-pub fn bitcoin_units::parse::UnprefixedHexError::clone(&self) -> bitcoin_units::parse::UnprefixedHexError
-pub fn bitcoin_units::parse::UnprefixedHexError::eq(&self, other: &bitcoin_units::parse::UnprefixedHexError) -> bool
-pub fn bitcoin_units::parse::UnprefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::UnprefixedHexError::from(e: bitcoin_units::parse::ParseIntError) -> Self
-pub fn bitcoin_units::parse::UnprefixedHexError::from(never: core::convert::Infallible) -> Self
-pub fn bitcoin_units::parse::UnprefixedHexError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
-pub fn bitcoin_units::parse::hex_check_unprefixed(s: &str) -> core::result::Result<&str, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::hex_remove_prefix(s: &str) -> core::result::Result<&str, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u128(s: &str) -> core::result::Result<u128, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u128_prefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u128_unchecked(s: &str) -> core::result::Result<u128, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u128_unprefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::hex_u32(s: &str) -> core::result::Result<u32, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u32_prefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u32_unchecked(s: &str) -> core::result::Result<u32, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u32_unprefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::int_from_box<T: bitcoin_units::parse::Integer>(s: alloc::boxed::Box<str>) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::int_from_str<T: bitcoin_units::parse::Integer>(s: &str) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::int_from_string<T: bitcoin_units::parse::Integer>(s: alloc::string::String) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
+pub fn bitcoin_units::parse_int::ParseIntError::as_ref(&self) -> &core::num::error::ParseIntError
+pub fn bitcoin_units::parse_int::ParseIntError::clone(&self) -> bitcoin_units::parse_int::ParseIntError
+pub fn bitcoin_units::parse_int::ParseIntError::eq(&self, other: &bitcoin_units::parse_int::ParseIntError) -> bool
+pub fn bitcoin_units::parse_int::ParseIntError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::ParseIntError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+pub fn bitcoin_units::parse_int::PrefixedHexError::clone(&self) -> bitcoin_units::parse_int::PrefixedHexError
+pub fn bitcoin_units::parse_int::PrefixedHexError::eq(&self, other: &bitcoin_units::parse_int::PrefixedHexError) -> bool
+pub fn bitcoin_units::parse_int::PrefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::PrefixedHexError::from(e: bitcoin_units::parse_int::ParseIntError) -> Self
+pub fn bitcoin_units::parse_int::PrefixedHexError::from(never: core::convert::Infallible) -> Self
+pub fn bitcoin_units::parse_int::PrefixedHexError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+pub fn bitcoin_units::parse_int::UnprefixedHexError::clone(&self) -> bitcoin_units::parse_int::UnprefixedHexError
+pub fn bitcoin_units::parse_int::UnprefixedHexError::eq(&self, other: &bitcoin_units::parse_int::UnprefixedHexError) -> bool
+pub fn bitcoin_units::parse_int::UnprefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::UnprefixedHexError::from(e: bitcoin_units::parse_int::ParseIntError) -> Self
+pub fn bitcoin_units::parse_int::UnprefixedHexError::from(never: core::convert::Infallible) -> Self
+pub fn bitcoin_units::parse_int::UnprefixedHexError::source(&self) -> core::option::Option<&(dyn core::error::Error + 'static)>
+pub fn bitcoin_units::parse_int::hex_check_unprefixed(s: &str) -> core::result::Result<&str, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::hex_remove_prefix(s: &str) -> core::result::Result<&str, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u128(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u128_prefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u128_unchecked(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u128_unprefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u32(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u32_prefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u32_unchecked(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u32_unprefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::int_from_box<T: bitcoin_units::parse_int::Integer>(s: alloc::boxed::Box<str>) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::int_from_str<T: bitcoin_units::parse_int::Integer>(s: &str) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::int_from_string<T: bitcoin_units::parse_int::Integer>(s: alloc::string::String) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
pub fn bitcoin_units::result::MathOp::arbitrary(u: &mut arbitrary::unstructured::Unstructured<'a>) -> arbitrary::error::Result<Self>
pub fn bitcoin_units::result::MathOp::clone(&self) -> bitcoin_units::result::MathOp
pub fn bitcoin_units::result::MathOp::eq(&self, other: &bitcoin_units::result::MathOp) -> bool
@@ -2203,11 +2203,11 @@ pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::rela
pub fn bitcoin_units::sequence::Sequence::from_512_second_intervals(intervals: u16) -> Self
pub fn bitcoin_units::sequence::Sequence::from_consensus(n: u32) -> Self
pub fn bitcoin_units::sequence::Sequence::from_height(height: u16) -> Self
-pub fn bitcoin_units::sequence::Sequence::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::PrefixedHexError>
+pub fn bitcoin_units::sequence::Sequence::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::PrefixedHexError>
pub fn bitcoin_units::sequence::Sequence::from_seconds_ceil(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub fn bitcoin_units::sequence::Sequence::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub fn bitcoin_units::sequence::Sequence::from_str(s: &str) -> core::result::Result<Self, Self::Err>
-pub fn bitcoin_units::sequence::Sequence::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::UnprefixedHexError>
+pub fn bitcoin_units::sequence::Sequence::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::sequence::Sequence::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
pub fn bitcoin_units::sequence::Sequence::is_final(self) -> bool
pub fn bitcoin_units::sequence::Sequence::is_height_locked(self) -> bool
@@ -2222,7 +2222,7 @@ pub fn bitcoin_units::sequence::Sequence::to_relative_lock_time(self) -> core::o
pub fn bitcoin_units::sequence::Sequence::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::sequence::Sequence::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::sequence::Sequence::try_from(s: alloc::string::String) -> core::result::Result<Self, Self::Error>
-pub fn core::num::error::ParseIntError::from(value: bitcoin_units::parse::ParseIntError) -> Self
+pub fn core::num::error::ParseIntError::from(value: bitcoin_units::parse_int::ParseIntError) -> Self
pub fn i64::mul(self, rhs: &bitcoin_units::SignedAmount) -> Self::Output
pub fn i64::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>) -> Self::Output
pub fn i64::mul(self, rhs: bitcoin_units::SignedAmount) -> Self::Output
@@ -2266,7 +2266,7 @@ pub mod bitcoin_units::locktime::absolute
pub mod bitcoin_units::locktime::absolute::error
pub mod bitcoin_units::locktime::relative
pub mod bitcoin_units::locktime::relative::error
-pub mod bitcoin_units::parse
+pub mod bitcoin_units::parse_int
pub mod bitcoin_units::relative
pub mod bitcoin_units::relative::error
pub mod bitcoin_units::result
@@ -2332,8 +2332,8 @@ pub struct bitcoin_units::locktime::relative::error::DisabledLockTimeError(_)
pub struct bitcoin_units::locktime::relative::error::InvalidHeightError
pub struct bitcoin_units::locktime::relative::error::InvalidTimeError
pub struct bitcoin_units::locktime::relative::error::TimeOverflowError
-pub struct bitcoin_units::parse::PrefixedHexError(_)
-pub struct bitcoin_units::parse::UnprefixedHexError(_)
+pub struct bitcoin_units::parse_int::PrefixedHexError(_)
+pub struct bitcoin_units::parse_int::UnprefixedHexError(_)
pub struct bitcoin_units::relative::DisabledLockTimeError(_)
pub struct bitcoin_units::relative::InvalidHeightError
pub struct bitcoin_units::relative::InvalidTimeError
@@ -2347,7 +2347,7 @@ pub struct bitcoin_units::relative::error::TimeOverflowError
pub struct bitcoin_units::sequence::Sequence(pub u32)
pub struct bitcoin_units::time::BlockTime(_)
pub struct bitcoin_units::weight::Weight(_)
-pub trait bitcoin_units::parse::Integer: core::str::traits::FromStr<Err = core::num::error::ParseIntError> + core::convert::TryFrom<i8> + core::marker::Sized + bitcoin_units::parse::sealed::Sealed
+pub trait bitcoin_units::parse_int::Integer: core::str::traits::FromStr<Err = core::num::error::ParseIntError> + core::convert::TryFrom<i8> + core::marker::Sized + bitcoin_units::parse_int::sealed::Sealed
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Add<bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>>::Output
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Add>::Output
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Div<bitcoin_units::FeeRate>>::Output
@@ -2458,8 +2458,8 @@ pub type bitcoin_units::SignedAmount::Output = <bitcoin_units::SignedAmount as c
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::SignedAmount
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::result::NumOpResult<i64>
-pub type bitcoin_units::Weight::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::Weight::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::Weight::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::Weight::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Add>::Output
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Div<core::num::nonzero::NonZero<u64>>>::Output
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Div<u64>>::Output
@@ -2474,44 +2474,44 @@ pub type bitcoin_units::Weight::Output = bitcoin_units::Weight
pub type bitcoin_units::Weight::Output = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
pub type bitcoin_units::Weight::Output = u64
pub type bitcoin_units::amount::Denomination::Err = bitcoin_units::amount::error::ParseDenominationError
-pub type bitcoin_units::block::BlockHeight::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockHeight::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockHeight::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockHeight::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Add<bitcoin_units::block::BlockHeightInterval>>::Output
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Sub<bitcoin_units::block::BlockHeightInterval>>::Output
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockHeight::Output = bitcoin_units::block::BlockHeight
pub type bitcoin_units::block::BlockHeight::Output = bitcoin_units::block::BlockHeightInterval
-pub type bitcoin_units::block::BlockHeightInterval::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockHeightInterval::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockHeightInterval::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockHeightInterval::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockHeightInterval::Output = <bitcoin_units::block::BlockHeightInterval as core::ops::arith::Add>::Output
pub type bitcoin_units::block::BlockHeightInterval::Output = <bitcoin_units::block::BlockHeightInterval as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockHeightInterval::Output = bitcoin_units::block::BlockHeightInterval
-pub type bitcoin_units::block::BlockMtp::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockMtp::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockMtp::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockMtp::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Add<bitcoin_units::block::BlockMtpInterval>>::Output
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Sub<bitcoin_units::block::BlockMtpInterval>>::Output
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockMtp::Output = bitcoin_units::block::BlockMtp
pub type bitcoin_units::block::BlockMtp::Output = bitcoin_units::block::BlockMtpInterval
-pub type bitcoin_units::block::BlockMtpInterval::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockMtpInterval::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockMtpInterval::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockMtpInterval::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockMtpInterval::Output = <bitcoin_units::block::BlockMtpInterval as core::ops::arith::Add>::Output
pub type bitcoin_units::block::BlockMtpInterval::Output = <bitcoin_units::block::BlockMtpInterval as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockMtpInterval::Output = bitcoin_units::block::BlockMtpInterval
pub type bitcoin_units::locktime::absolute::Height::Err = bitcoin_units::locktime::absolute::error::ParseHeightError
pub type bitcoin_units::locktime::absolute::Height::Error = bitcoin_units::locktime::absolute::error::ConversionError
pub type bitcoin_units::locktime::absolute::Height::Error = bitcoin_units::locktime::absolute::error::ParseHeightError
-pub type bitcoin_units::locktime::absolute::LockTime::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::absolute::LockTime::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::absolute::LockTime::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::absolute::LockTime::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Err = bitcoin_units::locktime::absolute::error::ParseTimeError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Error = bitcoin_units::locktime::absolute::error::ConversionError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Error = bitcoin_units::locktime::absolute::error::ParseTimeError
pub type bitcoin_units::locktime::relative::LockTime::Error = bitcoin_units::locktime::relative::error::DisabledLockTimeError
-pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Error = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::relative::NumberOfBlocks::Err = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Error = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOfBlocks::Err = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::block::TooBigForRelativeHeightError
-pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Add<T>>::Output
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Add>::Output
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Sub<T>>::Output
@@ -2537,8 +2537,8 @@ pub type bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::Output
pub type bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::Output = <bitcoin_units::result::NumOpResult<bitcoin_units::Weight> as core::ops::arith::Mul<bitcoin_units::FeeRate>>::Output
pub type bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::Output = <bitcoin_units::result::NumOpResult<bitcoin_units::Weight> as core::ops::arith::Mul<bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>>>::Output
pub type bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::Output = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
-pub type bitcoin_units::sequence::Sequence::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::sequence::Sequence::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::sequence::Sequence::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::sequence::Sequence::Error = bitcoin_units::parse_int::ParseIntError
pub type i64::Output = <i64 as core::ops::arith::Mul<bitcoin_units::SignedAmount>>::Output
pub type i64::Output = <i64 as core::ops::arith::Mul<bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>>::Output
pub type i64::Output = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
diff --git a/api/units/alloc-only.txt b/api/units/alloc-only.txt
index 97c2309e..3121d9c3 100644
--- a/api/units/alloc-only.txt
+++ b/api/units/alloc-only.txt
@@ -9,7 +9,7 @@
#[non_exhaustive] pub struct bitcoin_units::amount::error::UnknownDenominationError(_)
#[non_exhaustive] pub struct bitcoin_units::locktime::absolute::ConversionError
#[non_exhaustive] pub struct bitcoin_units::locktime::absolute::error::ConversionError
-#[non_exhaustive] pub struct bitcoin_units::parse::ParseIntError
+#[non_exhaustive] pub struct bitcoin_units::parse_int::ParseIntError
#[non_exhaustive] pub struct bitcoin_units::result::NumOpError(_)
impl bitcoin_units::Amount
impl bitcoin_units::BlockTime
@@ -32,16 +32,16 @@ impl bitcoin_units::locktime::relative::LockTime
impl bitcoin_units::locktime::relative::NumberOf512Seconds
impl bitcoin_units::locktime::relative::NumberOfBlocks
impl bitcoin_units::locktime::relative::error::DisabledLockTimeError
-impl bitcoin_units::parse::Integer for i128
-impl bitcoin_units::parse::Integer for i16
-impl bitcoin_units::parse::Integer for i32
-impl bitcoin_units::parse::Integer for i64
-impl bitcoin_units::parse::Integer for i8
-impl bitcoin_units::parse::Integer for u128
-impl bitcoin_units::parse::Integer for u16
-impl bitcoin_units::parse::Integer for u32
-impl bitcoin_units::parse::Integer for u64
-impl bitcoin_units::parse::Integer for u8
+impl bitcoin_units::parse_int::Integer for i128
+impl bitcoin_units::parse_int::Integer for i16
+impl bitcoin_units::parse_int::Integer for i32
+impl bitcoin_units::parse_int::Integer for i64
+impl bitcoin_units::parse_int::Integer for i8
+impl bitcoin_units::parse_int::Integer for u128
+impl bitcoin_units::parse_int::Integer for u16
+impl bitcoin_units::parse_int::Integer for u32
+impl bitcoin_units::parse_int::Integer for u64
+impl bitcoin_units::parse_int::Integer for u8
impl bitcoin_units::result::MathOp
impl bitcoin_units::result::NumOpError
impl bitcoin_units::sequence::Sequence
@@ -86,9 +86,9 @@ impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::clone::Clone for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::clone::Clone for bitcoin_units::parse::ParseIntError
-impl core::clone::Clone for bitcoin_units::parse::PrefixedHexError
-impl core::clone::Clone for bitcoin_units::parse::UnprefixedHexError
+impl core::clone::Clone for bitcoin_units::parse_int::ParseIntError
+impl core::clone::Clone for bitcoin_units::parse_int::PrefixedHexError
+impl core::clone::Clone for bitcoin_units::parse_int::UnprefixedHexError
impl core::clone::Clone for bitcoin_units::result::MathOp
impl core::clone::Clone for bitcoin_units::result::NumOpError
impl core::clone::Clone for bitcoin_units::sequence::Sequence
@@ -132,9 +132,9 @@ impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByEr
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::cmp::Eq for bitcoin_units::parse::ParseIntError
-impl core::cmp::Eq for bitcoin_units::parse::PrefixedHexError
-impl core::cmp::Eq for bitcoin_units::parse::UnprefixedHexError
+impl core::cmp::Eq for bitcoin_units::parse_int::ParseIntError
+impl core::cmp::Eq for bitcoin_units::parse_int::PrefixedHexError
+impl core::cmp::Eq for bitcoin_units::parse_int::UnprefixedHexError
impl core::cmp::Eq for bitcoin_units::result::MathOp
impl core::cmp::Eq for bitcoin_units::result::NumOpError
impl core::cmp::Eq for bitcoin_units::sequence::Sequence
@@ -192,9 +192,9 @@ impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisf
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::cmp::PartialEq for bitcoin_units::parse::ParseIntError
-impl core::cmp::PartialEq for bitcoin_units::parse::PrefixedHexError
-impl core::cmp::PartialEq for bitcoin_units::parse::UnprefixedHexError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::ParseIntError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::PrefixedHexError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::UnprefixedHexError
impl core::cmp::PartialEq for bitcoin_units::result::MathOp
impl core::cmp::PartialEq for bitcoin_units::result::NumOpError
impl core::cmp::PartialEq for bitcoin_units::sequence::Sequence
@@ -212,7 +212,7 @@ impl core::cmp::PartialOrd for bitcoin_units::locktime::absolute::MedianTimePast
impl core::cmp::PartialOrd for bitcoin_units::locktime::relative::NumberOf512Seconds
impl core::cmp::PartialOrd for bitcoin_units::locktime::relative::NumberOfBlocks
impl core::cmp::PartialOrd for bitcoin_units::sequence::Sequence
-impl core::convert::AsRef<core::num::error::ParseIntError> for bitcoin_units::parse::ParseIntError
+impl core::convert::AsRef<core::num::error::ParseIntError> for bitcoin_units::parse_int::ParseIntError
impl core::convert::From<&bitcoin_units::Amount> for bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
impl core::convert::From<&bitcoin_units::SignedAmount> for bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
impl core::convert::From<bitcoin_units::Amount> for bitcoin_units::SignedAmount
@@ -245,15 +245,15 @@ impl core::convert::From<bitcoin_units::locktime::relative::NumberOf512Seconds>
impl core::convert::From<bitcoin_units::locktime::relative::NumberOf512Seconds> for bitcoin_units::locktime::relative::LockTime
impl core::convert::From<bitcoin_units::locktime::relative::NumberOfBlocks> for bitcoin_units::block::BlockHeightInterval
impl core::convert::From<bitcoin_units::locktime::relative::NumberOfBlocks> for bitcoin_units::locktime::relative::LockTime
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for bitcoin_units::parse::PrefixedHexError
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for bitcoin_units::parse::UnprefixedHexError
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for core::num::error::ParseIntError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for bitcoin_units::parse_int::PrefixedHexError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for bitcoin_units::parse_int::UnprefixedHexError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for core::num::error::ParseIntError
impl core::convert::From<bitcoin_units::sequence::Sequence> for u32
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseAmountError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseDenominationError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseError
-impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse::PrefixedHexError
-impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse::UnprefixedHexError
+impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse_int::PrefixedHexError
+impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse_int::UnprefixedHexError
impl core::convert::From<u16> for bitcoin_units::locktime::relative::NumberOfBlocks
impl core::convert::From<u32> for bitcoin_units::BlockTime
impl core::convert::From<u32> for bitcoin_units::block::BlockHeight
@@ -346,9 +346,9 @@ impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedB
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::fmt::Debug for bitcoin_units::parse::ParseIntError
-impl core::fmt::Debug for bitcoin_units::parse::PrefixedHexError
-impl core::fmt::Debug for bitcoin_units::parse::UnprefixedHexError
+impl core::fmt::Debug for bitcoin_units::parse_int::ParseIntError
+impl core::fmt::Debug for bitcoin_units::parse_int::PrefixedHexError
+impl core::fmt::Debug for bitcoin_units::parse_int::UnprefixedHexError
impl core::fmt::Debug for bitcoin_units::result::MathOp
impl core::fmt::Debug for bitcoin_units::result::NumOpError
impl core::fmt::Debug for bitcoin_units::sequence::Sequence
@@ -390,9 +390,9 @@ impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::fmt::Display for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::fmt::Display for bitcoin_units::parse::ParseIntError
-impl core::fmt::Display for bitcoin_units::parse::PrefixedHexError
-impl core::fmt::Display for bitcoin_units::parse::UnprefixedHexError
+impl core::fmt::Display for bitcoin_units::parse_int::ParseIntError
+impl core::fmt::Display for bitcoin_units::parse_int::PrefixedHexError
+impl core::fmt::Display for bitcoin_units::parse_int::UnprefixedHexError
impl core::fmt::Display for bitcoin_units::result::MathOp
impl core::fmt::Display for bitcoin_units::result::NumOpError
impl core::fmt::Display for bitcoin_units::sequence::Sequence
@@ -482,9 +482,9 @@ impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisf
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Freeze for bitcoin_units::parse::ParseIntError
-impl core::marker::Freeze for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Freeze for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Freeze for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Freeze for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Freeze for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Freeze for bitcoin_units::result::MathOp
impl core::marker::Freeze for bitcoin_units::result::NumOpError
impl core::marker::Freeze for bitcoin_units::sequence::Sequence
@@ -529,9 +529,9 @@ impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Send for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Send for bitcoin_units::parse::ParseIntError
-impl core::marker::Send for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Send for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Send for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Send for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Send for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Send for bitcoin_units::result::MathOp
impl core::marker::Send for bitcoin_units::result::NumOpError
impl core::marker::Send for bitcoin_units::sequence::Sequence
@@ -575,9 +575,9 @@ impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::er
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::ParseIntError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::PrefixedHexError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::ParseIntError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::StructuralPartialEq for bitcoin_units::result::MathOp
impl core::marker::StructuralPartialEq for bitcoin_units::result::NumOpError
impl core::marker::StructuralPartialEq for bitcoin_units::sequence::Sequence
@@ -622,9 +622,9 @@ impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Sync for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Sync for bitcoin_units::parse::ParseIntError
-impl core::marker::Sync for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Sync for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Sync for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Sync for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Sync for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Sync for bitcoin_units::result::MathOp
impl core::marker::Sync for bitcoin_units::result::NumOpError
impl core::marker::Sync for bitcoin_units::sequence::Sequence
@@ -669,9 +669,9 @@ impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfi
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Unpin for bitcoin_units::parse::ParseIntError
-impl core::marker::Unpin for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Unpin for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Unpin for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Unpin for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Unpin for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Unpin for bitcoin_units::result::MathOp
impl core::marker::Unpin for bitcoin_units::result::NumOpError
impl core::marker::Unpin for bitcoin_units::sequence::Sequence
@@ -942,9 +942,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relati
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::ParseIntError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::PrefixedHexError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::UnprefixedHexError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::ParseIntError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::PrefixedHexError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::UnprefixedHexError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::result::MathOp
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::result::NumOpError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::sequence::Sequence
@@ -989,9 +989,9 @@ impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative:
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::ParseIntError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::PrefixedHexError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::UnprefixedHexError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::ParseIntError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::PrefixedHexError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::UnprefixedHexError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::result::MathOp
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::result::NumOpError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::sequence::Sequence
@@ -1820,10 +1820,10 @@ pub fn bitcoin_units::locktime::absolute::LockTime::from(h: bitcoin_units::lockt
pub fn bitcoin_units::locktime::absolute::LockTime::from(t: bitcoin_units::locktime::absolute::MedianTimePast) -> Self
pub fn bitcoin_units::locktime::absolute::LockTime::from_consensus(n: u32) -> Self
pub fn bitcoin_units::locktime::absolute::LockTime::from_height(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
-pub fn bitcoin_units::locktime::absolute::LockTime::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::PrefixedHexError>
+pub fn bitcoin_units::locktime::absolute::LockTime::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::PrefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::from_mtp(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub fn bitcoin_units::locktime::absolute::LockTime::from_str(s: &str) -> core::result::Result<Self, Self::Err>
-pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::UnprefixedHexError>
+pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
@@ -1930,33 +1930,33 @@ pub fn bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError::fmt(&se
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::clone(&self) -> bitcoin_units::locktime::relative::error::TimeOverflowError
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::eq(&self, other: &bitcoin_units::locktime::relative::error::TimeOverflowError) -> bool
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::ParseIntError::as_ref(&self) -> &core::num::error::ParseIntError
-pub fn bitcoin_units::parse::ParseIntError::clone(&self) -> bitcoin_units::parse::ParseIntError
-pub fn bitcoin_units::parse::ParseIntError::eq(&self, other: &bitcoin_units::parse::ParseIntError) -> bool
-pub fn bitcoin_units::parse::ParseIntError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::PrefixedHexError::clone(&self) -> bitcoin_units::parse::PrefixedHexError
-pub fn bitcoin_units::parse::PrefixedHexError::eq(&self, other: &bitcoin_units::parse::PrefixedHexError) -> bool
-pub fn bitcoin_units::parse::PrefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::PrefixedHexError::from(e: bitcoin_units::parse::ParseIntError) -> Self
-pub fn bitcoin_units::parse::PrefixedHexError::from(never: core::convert::Infallible) -> Self
-pub fn bitcoin_units::parse::UnprefixedHexError::clone(&self) -> bitcoin_units::parse::UnprefixedHexError
-pub fn bitcoin_units::parse::UnprefixedHexError::eq(&self, other: &bitcoin_units::parse::UnprefixedHexError) -> bool
-pub fn bitcoin_units::parse::UnprefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::UnprefixedHexError::from(e: bitcoin_units::parse::ParseIntError) -> Self
-pub fn bitcoin_units::parse::UnprefixedHexError::from(never: core::convert::Infallible) -> Self
-pub fn bitcoin_units::parse::hex_check_unprefixed(s: &str) -> core::result::Result<&str, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::hex_remove_prefix(s: &str) -> core::result::Result<&str, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u128(s: &str) -> core::result::Result<u128, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u128_prefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u128_unchecked(s: &str) -> core::result::Result<u128, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u128_unprefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::hex_u32(s: &str) -> core::result::Result<u32, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u32_prefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u32_unchecked(s: &str) -> core::result::Result<u32, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u32_unprefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::int_from_box<T: bitcoin_units::parse::Integer>(s: alloc::boxed::Box<str>) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::int_from_str<T: bitcoin_units::parse::Integer>(s: &str) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::int_from_string<T: bitcoin_units::parse::Integer>(s: alloc::string::String) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
+pub fn bitcoin_units::parse_int::ParseIntError::as_ref(&self) -> &core::num::error::ParseIntError
+pub fn bitcoin_units::parse_int::ParseIntError::clone(&self) -> bitcoin_units::parse_int::ParseIntError
+pub fn bitcoin_units::parse_int::ParseIntError::eq(&self, other: &bitcoin_units::parse_int::ParseIntError) -> bool
+pub fn bitcoin_units::parse_int::ParseIntError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::PrefixedHexError::clone(&self) -> bitcoin_units::parse_int::PrefixedHexError
+pub fn bitcoin_units::parse_int::PrefixedHexError::eq(&self, other: &bitcoin_units::parse_int::PrefixedHexError) -> bool
+pub fn bitcoin_units::parse_int::PrefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::PrefixedHexError::from(e: bitcoin_units::parse_int::ParseIntError) -> Self
+pub fn bitcoin_units::parse_int::PrefixedHexError::from(never: core::convert::Infallible) -> Self
+pub fn bitcoin_units::parse_int::UnprefixedHexError::clone(&self) -> bitcoin_units::parse_int::UnprefixedHexError
+pub fn bitcoin_units::parse_int::UnprefixedHexError::eq(&self, other: &bitcoin_units::parse_int::UnprefixedHexError) -> bool
+pub fn bitcoin_units::parse_int::UnprefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::UnprefixedHexError::from(e: bitcoin_units::parse_int::ParseIntError) -> Self
+pub fn bitcoin_units::parse_int::UnprefixedHexError::from(never: core::convert::Infallible) -> Self
+pub fn bitcoin_units::parse_int::hex_check_unprefixed(s: &str) -> core::result::Result<&str, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::hex_remove_prefix(s: &str) -> core::result::Result<&str, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u128(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u128_prefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u128_unchecked(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u128_unprefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u32(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u32_prefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u32_unchecked(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u32_unprefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::int_from_box<T: bitcoin_units::parse_int::Integer>(s: alloc::boxed::Box<str>) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::int_from_str<T: bitcoin_units::parse_int::Integer>(s: &str) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::int_from_string<T: bitcoin_units::parse_int::Integer>(s: alloc::string::String) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
pub fn bitcoin_units::result::MathOp::clone(&self) -> bitcoin_units::result::MathOp
pub fn bitcoin_units::result::MathOp::eq(&self, other: &bitcoin_units::result::MathOp) -> bool
pub fn bitcoin_units::result::MathOp::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
@@ -2048,11 +2048,11 @@ pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::rela
pub fn bitcoin_units::sequence::Sequence::from_512_second_intervals(intervals: u16) -> Self
pub fn bitcoin_units::sequence::Sequence::from_consensus(n: u32) -> Self
pub fn bitcoin_units::sequence::Sequence::from_height(height: u16) -> Self
-pub fn bitcoin_units::sequence::Sequence::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::PrefixedHexError>
+pub fn bitcoin_units::sequence::Sequence::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::PrefixedHexError>
pub fn bitcoin_units::sequence::Sequence::from_seconds_ceil(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub fn bitcoin_units::sequence::Sequence::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub fn bitcoin_units::sequence::Sequence::from_str(s: &str) -> core::result::Result<Self, Self::Err>
-pub fn bitcoin_units::sequence::Sequence::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::UnprefixedHexError>
+pub fn bitcoin_units::sequence::Sequence::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::sequence::Sequence::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
pub fn bitcoin_units::sequence::Sequence::is_final(self) -> bool
pub fn bitcoin_units::sequence::Sequence::is_height_locked(self) -> bool
@@ -2066,7 +2066,7 @@ pub fn bitcoin_units::sequence::Sequence::to_relative_lock_time(self) -> core::o
pub fn bitcoin_units::sequence::Sequence::try_from(s: &str) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::sequence::Sequence::try_from(s: alloc::boxed::Box<str>) -> core::result::Result<Self, Self::Error>
pub fn bitcoin_units::sequence::Sequence::try_from(s: alloc::string::String) -> core::result::Result<Self, Self::Error>
-pub fn core::num::error::ParseIntError::from(value: bitcoin_units::parse::ParseIntError) -> Self
+pub fn core::num::error::ParseIntError::from(value: bitcoin_units::parse_int::ParseIntError) -> Self
pub fn i64::mul(self, rhs: &bitcoin_units::SignedAmount) -> Self::Output
pub fn i64::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>) -> Self::Output
pub fn i64::mul(self, rhs: bitcoin_units::SignedAmount) -> Self::Output
@@ -2096,7 +2096,7 @@ pub mod bitcoin_units::locktime::absolute
pub mod bitcoin_units::locktime::absolute::error
pub mod bitcoin_units::locktime::relative
pub mod bitcoin_units::locktime::relative::error
-pub mod bitcoin_units::parse
+pub mod bitcoin_units::parse_int
pub mod bitcoin_units::relative
pub mod bitcoin_units::relative::error
pub mod bitcoin_units::result
@@ -2162,8 +2162,8 @@ pub struct bitcoin_units::locktime::relative::error::DisabledLockTimeError(_)
pub struct bitcoin_units::locktime::relative::error::InvalidHeightError
pub struct bitcoin_units::locktime::relative::error::InvalidTimeError
pub struct bitcoin_units::locktime::relative::error::TimeOverflowError
-pub struct bitcoin_units::parse::PrefixedHexError(_)
-pub struct bitcoin_units::parse::UnprefixedHexError(_)
+pub struct bitcoin_units::parse_int::PrefixedHexError(_)
+pub struct bitcoin_units::parse_int::UnprefixedHexError(_)
pub struct bitcoin_units::relative::DisabledLockTimeError(_)
pub struct bitcoin_units::relative::InvalidHeightError
pub struct bitcoin_units::relative::InvalidTimeError
@@ -2177,7 +2177,7 @@ pub struct bitcoin_units::relative::error::TimeOverflowError
pub struct bitcoin_units::sequence::Sequence(pub u32)
pub struct bitcoin_units::time::BlockTime(_)
pub struct bitcoin_units::weight::Weight(_)
-pub trait bitcoin_units::parse::Integer: core::str::traits::FromStr<Err = core::num::error::ParseIntError> + core::convert::TryFrom<i8> + core::marker::Sized + bitcoin_units::parse::sealed::Sealed
+pub trait bitcoin_units::parse_int::Integer: core::str::traits::FromStr<Err = core::num::error::ParseIntError> + core::convert::TryFrom<i8> + core::marker::Sized + bitcoin_units::parse_int::sealed::Sealed
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Add<bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>>::Output
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Add>::Output
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Div<bitcoin_units::FeeRate>>::Output
@@ -2288,8 +2288,8 @@ pub type bitcoin_units::SignedAmount::Output = <bitcoin_units::SignedAmount as c
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::SignedAmount
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::result::NumOpResult<i64>
-pub type bitcoin_units::Weight::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::Weight::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::Weight::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::Weight::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Add>::Output
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Div<core::num::nonzero::NonZero<u64>>>::Output
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Div<u64>>::Output
@@ -2304,44 +2304,44 @@ pub type bitcoin_units::Weight::Output = bitcoin_units::Weight
pub type bitcoin_units::Weight::Output = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
pub type bitcoin_units::Weight::Output = u64
pub type bitcoin_units::amount::Denomination::Err = bitcoin_units::amount::error::ParseDenominationError
-pub type bitcoin_units::block::BlockHeight::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockHeight::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockHeight::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockHeight::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Add<bitcoin_units::block::BlockHeightInterval>>::Output
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Sub<bitcoin_units::block::BlockHeightInterval>>::Output
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockHeight::Output = bitcoin_units::block::BlockHeight
pub type bitcoin_units::block::BlockHeight::Output = bitcoin_units::block::BlockHeightInterval
-pub type bitcoin_units::block::BlockHeightInterval::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockHeightInterval::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockHeightInterval::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockHeightInterval::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockHeightInterval::Output = <bitcoin_units::block::BlockHeightInterval as core::ops::arith::Add>::Output
pub type bitcoin_units::block::BlockHeightInterval::Output = <bitcoin_units::block::BlockHeightInterval as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockHeightInterval::Output = bitcoin_units::block::BlockHeightInterval
-pub type bitcoin_units::block::BlockMtp::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockMtp::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockMtp::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockMtp::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Add<bitcoin_units::block::BlockMtpInterval>>::Output
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Sub<bitcoin_units::block::BlockMtpInterval>>::Output
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockMtp::Output = bitcoin_units::block::BlockMtp
pub type bitcoin_units::block::BlockMtp::Output = bitcoin_units::block::BlockMtpInterval
-pub type bitcoin_units::block::BlockMtpInterval::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockMtpInterval::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockMtpInterval::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockMtpInterval::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockMtpInterval::Output = <bitcoin_units::block::BlockMtpInterval as core::ops::arith::Add>::Output
pub type bitcoin_units::block::BlockMtpInterval::Output = <bitcoin_units::block::BlockMtpInterval as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockMtpInterval::Output = bitcoin_units::block::BlockMtpInterval
pub type bitcoin_units::locktime::absolute::Height::Err = bitcoin_units::locktime::absolute::error::ParseHeightError
pub type bitcoin_units::locktime::absolute::Height::Error = bitcoin_units::locktime::absolute::error::ConversionError
pub type bitcoin_units::locktime::absolute::Height::Error = bitcoin_units::locktime::absolute::error::ParseHeightError
-pub type bitcoin_units::locktime::absolute::LockTime::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::absolute::LockTime::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::absolute::LockTime::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::absolute::LockTime::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Err = bitcoin_units::locktime::absolute::error::ParseTimeError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Error = bitcoin_units::locktime::absolute::error::ConversionError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Error = bitcoin_units::locktime::absolute::error::ParseTimeError
pub type bitcoin_units::locktime::relative::LockTime::Error = bitcoin_units::locktime::relative::error::DisabledLockTimeError
-pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Error = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::relative::NumberOfBlocks::Err = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Error = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOfBlocks::Err = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::block::TooBigForRelativeHeightError
-pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Add<T>>::Output
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Add>::Output
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Sub<T>>::Output
@@ -2367,8 +2367,8 @@ pub type bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>::Output
pub type bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::Output = <bitcoin_units::result::NumOpResult<bitcoin_units::Weight> as core::ops::arith::Mul<bitcoin_units::FeeRate>>::Output
pub type bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::Output = <bitcoin_units::result::NumOpResult<bitcoin_units::Weight> as core::ops::arith::Mul<bitcoin_units::result::NumOpResult<bitcoin_units::FeeRate>>>::Output
pub type bitcoin_units::result::NumOpResult<bitcoin_units::Weight>::Output = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
-pub type bitcoin_units::sequence::Sequence::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::sequence::Sequence::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::sequence::Sequence::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::sequence::Sequence::Error = bitcoin_units::parse_int::ParseIntError
pub type i64::Output = <i64 as core::ops::arith::Mul<bitcoin_units::SignedAmount>>::Output
pub type i64::Output = <i64 as core::ops::arith::Mul<bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>>>::Output
pub type i64::Output = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
diff --git a/api/units/no-features.txt b/api/units/no-features.txt
index bfc70768..2933bf5a 100644
--- a/api/units/no-features.txt
+++ b/api/units/no-features.txt
@@ -9,7 +9,7 @@
#[non_exhaustive] pub struct bitcoin_units::amount::error::UnknownDenominationError(_)
#[non_exhaustive] pub struct bitcoin_units::locktime::absolute::ConversionError
#[non_exhaustive] pub struct bitcoin_units::locktime::absolute::error::ConversionError
-#[non_exhaustive] pub struct bitcoin_units::parse::ParseIntError
+#[non_exhaustive] pub struct bitcoin_units::parse_int::ParseIntError
#[non_exhaustive] pub struct bitcoin_units::result::NumOpError(_)
impl bitcoin_units::Amount
impl bitcoin_units::BlockTime
@@ -32,16 +32,16 @@ impl bitcoin_units::locktime::relative::LockTime
impl bitcoin_units::locktime::relative::NumberOf512Seconds
impl bitcoin_units::locktime::relative::NumberOfBlocks
impl bitcoin_units::locktime::relative::error::DisabledLockTimeError
-impl bitcoin_units::parse::Integer for i128
-impl bitcoin_units::parse::Integer for i16
-impl bitcoin_units::parse::Integer for i32
-impl bitcoin_units::parse::Integer for i64
-impl bitcoin_units::parse::Integer for i8
-impl bitcoin_units::parse::Integer for u128
-impl bitcoin_units::parse::Integer for u16
-impl bitcoin_units::parse::Integer for u32
-impl bitcoin_units::parse::Integer for u64
-impl bitcoin_units::parse::Integer for u8
+impl bitcoin_units::parse_int::Integer for i128
+impl bitcoin_units::parse_int::Integer for i16
+impl bitcoin_units::parse_int::Integer for i32
+impl bitcoin_units::parse_int::Integer for i64
+impl bitcoin_units::parse_int::Integer for i8
+impl bitcoin_units::parse_int::Integer for u128
+impl bitcoin_units::parse_int::Integer for u16
+impl bitcoin_units::parse_int::Integer for u32
+impl bitcoin_units::parse_int::Integer for u64
+impl bitcoin_units::parse_int::Integer for u8
impl bitcoin_units::result::MathOp
impl bitcoin_units::result::NumOpError
impl bitcoin_units::sequence::Sequence
@@ -86,9 +86,9 @@ impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::clone::Clone for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::clone::Clone for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::clone::Clone for bitcoin_units::parse::ParseIntError
-impl core::clone::Clone for bitcoin_units::parse::PrefixedHexError
-impl core::clone::Clone for bitcoin_units::parse::UnprefixedHexError
+impl core::clone::Clone for bitcoin_units::parse_int::ParseIntError
+impl core::clone::Clone for bitcoin_units::parse_int::PrefixedHexError
+impl core::clone::Clone for bitcoin_units::parse_int::UnprefixedHexError
impl core::clone::Clone for bitcoin_units::result::MathOp
impl core::clone::Clone for bitcoin_units::result::NumOpError
impl core::clone::Clone for bitcoin_units::sequence::Sequence
@@ -132,9 +132,9 @@ impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByEr
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::cmp::Eq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::cmp::Eq for bitcoin_units::parse::ParseIntError
-impl core::cmp::Eq for bitcoin_units::parse::PrefixedHexError
-impl core::cmp::Eq for bitcoin_units::parse::UnprefixedHexError
+impl core::cmp::Eq for bitcoin_units::parse_int::ParseIntError
+impl core::cmp::Eq for bitcoin_units::parse_int::PrefixedHexError
+impl core::cmp::Eq for bitcoin_units::parse_int::UnprefixedHexError
impl core::cmp::Eq for bitcoin_units::result::MathOp
impl core::cmp::Eq for bitcoin_units::result::NumOpError
impl core::cmp::Eq for bitcoin_units::sequence::Sequence
@@ -192,9 +192,9 @@ impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisf
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::cmp::PartialEq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::cmp::PartialEq for bitcoin_units::parse::ParseIntError
-impl core::cmp::PartialEq for bitcoin_units::parse::PrefixedHexError
-impl core::cmp::PartialEq for bitcoin_units::parse::UnprefixedHexError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::ParseIntError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::PrefixedHexError
+impl core::cmp::PartialEq for bitcoin_units::parse_int::UnprefixedHexError
impl core::cmp::PartialEq for bitcoin_units::result::MathOp
impl core::cmp::PartialEq for bitcoin_units::result::NumOpError
impl core::cmp::PartialEq for bitcoin_units::sequence::Sequence
@@ -212,7 +212,7 @@ impl core::cmp::PartialOrd for bitcoin_units::locktime::absolute::MedianTimePast
impl core::cmp::PartialOrd for bitcoin_units::locktime::relative::NumberOf512Seconds
impl core::cmp::PartialOrd for bitcoin_units::locktime::relative::NumberOfBlocks
impl core::cmp::PartialOrd for bitcoin_units::sequence::Sequence
-impl core::convert::AsRef<core::num::error::ParseIntError> for bitcoin_units::parse::ParseIntError
+impl core::convert::AsRef<core::num::error::ParseIntError> for bitcoin_units::parse_int::ParseIntError
impl core::convert::From<&bitcoin_units::Amount> for bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
impl core::convert::From<&bitcoin_units::SignedAmount> for bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
impl core::convert::From<bitcoin_units::Amount> for bitcoin_units::SignedAmount
@@ -245,15 +245,15 @@ impl core::convert::From<bitcoin_units::locktime::relative::NumberOf512Seconds>
impl core::convert::From<bitcoin_units::locktime::relative::NumberOf512Seconds> for bitcoin_units::locktime::relative::LockTime
impl core::convert::From<bitcoin_units::locktime::relative::NumberOfBlocks> for bitcoin_units::block::BlockHeightInterval
impl core::convert::From<bitcoin_units::locktime::relative::NumberOfBlocks> for bitcoin_units::locktime::relative::LockTime
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for bitcoin_units::parse::PrefixedHexError
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for bitcoin_units::parse::UnprefixedHexError
-impl core::convert::From<bitcoin_units::parse::ParseIntError> for core::num::error::ParseIntError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for bitcoin_units::parse_int::PrefixedHexError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for bitcoin_units::parse_int::UnprefixedHexError
+impl core::convert::From<bitcoin_units::parse_int::ParseIntError> for core::num::error::ParseIntError
impl core::convert::From<bitcoin_units::sequence::Sequence> for u32
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseAmountError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseDenominationError
impl core::convert::From<core::convert::Infallible> for bitcoin_units::amount::error::ParseError
-impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse::PrefixedHexError
-impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse::UnprefixedHexError
+impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse_int::PrefixedHexError
+impl core::convert::From<core::convert::Infallible> for bitcoin_units::parse_int::UnprefixedHexError
impl core::convert::From<u16> for bitcoin_units::locktime::relative::NumberOfBlocks
impl core::convert::From<u32> for bitcoin_units::BlockTime
impl core::convert::From<u32> for bitcoin_units::block::BlockHeight
@@ -323,9 +323,9 @@ impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedB
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::fmt::Debug for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::fmt::Debug for bitcoin_units::parse::ParseIntError
-impl core::fmt::Debug for bitcoin_units::parse::PrefixedHexError
-impl core::fmt::Debug for bitcoin_units::parse::UnprefixedHexError
+impl core::fmt::Debug for bitcoin_units::parse_int::ParseIntError
+impl core::fmt::Debug for bitcoin_units::parse_int::PrefixedHexError
+impl core::fmt::Debug for bitcoin_units::parse_int::UnprefixedHexError
impl core::fmt::Debug for bitcoin_units::result::MathOp
impl core::fmt::Debug for bitcoin_units::result::NumOpError
impl core::fmt::Debug for bitcoin_units::sequence::Sequence
@@ -367,9 +367,9 @@ impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::fmt::Display for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::fmt::Display for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::fmt::Display for bitcoin_units::parse::ParseIntError
-impl core::fmt::Display for bitcoin_units::parse::PrefixedHexError
-impl core::fmt::Display for bitcoin_units::parse::UnprefixedHexError
+impl core::fmt::Display for bitcoin_units::parse_int::ParseIntError
+impl core::fmt::Display for bitcoin_units::parse_int::PrefixedHexError
+impl core::fmt::Display for bitcoin_units::parse_int::UnprefixedHexError
impl core::fmt::Display for bitcoin_units::result::MathOp
impl core::fmt::Display for bitcoin_units::result::NumOpError
impl core::fmt::Display for bitcoin_units::sequence::Sequence
@@ -459,9 +459,9 @@ impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisf
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Freeze for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Freeze for bitcoin_units::parse::ParseIntError
-impl core::marker::Freeze for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Freeze for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Freeze for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Freeze for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Freeze for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Freeze for bitcoin_units::result::MathOp
impl core::marker::Freeze for bitcoin_units::result::NumOpError
impl core::marker::Freeze for bitcoin_units::sequence::Sequence
@@ -506,9 +506,9 @@ impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Send for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Send for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Send for bitcoin_units::parse::ParseIntError
-impl core::marker::Send for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Send for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Send for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Send for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Send for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Send for bitcoin_units::result::MathOp
impl core::marker::Send for bitcoin_units::result::NumOpError
impl core::marker::Send for bitcoin_units::sequence::Sequence
@@ -552,9 +552,9 @@ impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::er
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::StructuralPartialEq for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::ParseIntError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::PrefixedHexError
-impl core::marker::StructuralPartialEq for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::ParseIntError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::StructuralPartialEq for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::StructuralPartialEq for bitcoin_units::result::MathOp
impl core::marker::StructuralPartialEq for bitcoin_units::result::NumOpError
impl core::marker::StructuralPartialEq for bitcoin_units::sequence::Sequence
@@ -599,9 +599,9 @@ impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfie
impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Sync for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Sync for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Sync for bitcoin_units::parse::ParseIntError
-impl core::marker::Sync for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Sync for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Sync for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Sync for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Sync for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Sync for bitcoin_units::result::MathOp
impl core::marker::Sync for bitcoin_units::result::NumOpError
impl core::marker::Sync for bitcoin_units::sequence::Sequence
@@ -646,9 +646,9 @@ impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfi
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::marker::Unpin for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::marker::Unpin for bitcoin_units::parse::ParseIntError
-impl core::marker::Unpin for bitcoin_units::parse::PrefixedHexError
-impl core::marker::Unpin for bitcoin_units::parse::UnprefixedHexError
+impl core::marker::Unpin for bitcoin_units::parse_int::ParseIntError
+impl core::marker::Unpin for bitcoin_units::parse_int::PrefixedHexError
+impl core::marker::Unpin for bitcoin_units::parse_int::UnprefixedHexError
impl core::marker::Unpin for bitcoin_units::result::MathOp
impl core::marker::Unpin for bitcoin_units::result::NumOpError
impl core::marker::Unpin for bitcoin_units::sequence::Sequence
@@ -919,9 +919,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relati
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::ParseIntError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::PrefixedHexError
-impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse::UnprefixedHexError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::ParseIntError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::PrefixedHexError
+impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::parse_int::UnprefixedHexError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::result::MathOp
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::result::NumOpError
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin_units::sequence::Sequence
@@ -966,9 +966,9 @@ impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative:
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByHeightError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::locktime::relative::error::TimeOverflowError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::ParseIntError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::PrefixedHexError
-impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse::UnprefixedHexError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::ParseIntError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::PrefixedHexError
+impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::parse_int::UnprefixedHexError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::result::MathOp
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::result::NumOpError
impl core::panic::unwind_safe::UnwindSafe for bitcoin_units::sequence::Sequence
@@ -1772,10 +1772,10 @@ pub fn bitcoin_units::locktime::absolute::LockTime::from(h: bitcoin_units::lockt
pub fn bitcoin_units::locktime::absolute::LockTime::from(t: bitcoin_units::locktime::absolute::MedianTimePast) -> Self
pub fn bitcoin_units::locktime::absolute::LockTime::from_consensus(n: u32) -> Self
pub fn bitcoin_units::locktime::absolute::LockTime::from_height(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
-pub fn bitcoin_units::locktime::absolute::LockTime::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::PrefixedHexError>
+pub fn bitcoin_units::locktime::absolute::LockTime::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::PrefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::from_mtp(n: u32) -> core::result::Result<Self, bitcoin_units::locktime::absolute::error::ConversionError>
pub fn bitcoin_units::locktime::absolute::LockTime::from_str(s: &str) -> core::result::Result<Self, Self::Err>
-pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::UnprefixedHexError>
+pub fn bitcoin_units::locktime::absolute::LockTime::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::locktime::absolute::LockTime::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
pub fn bitcoin_units::locktime::absolute::LockTime::is_implied_by(self, other: bitcoin_units::locktime::absolute::LockTime) -> bool
pub fn bitcoin_units::locktime::absolute::LockTime::is_satisfied_by(self, height: bitcoin_units::locktime::absolute::Height, mtp: bitcoin_units::locktime::absolute::MedianTimePast) -> bool
@@ -1874,31 +1874,31 @@ pub fn bitcoin_units::locktime::relative::error::IsSatisfiedByTimeError::fmt(&se
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::clone(&self) -> bitcoin_units::locktime::relative::error::TimeOverflowError
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::eq(&self, other: &bitcoin_units::locktime::relative::error::TimeOverflowError) -> bool
pub fn bitcoin_units::locktime::relative::error::TimeOverflowError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::ParseIntError::as_ref(&self) -> &core::num::error::ParseIntError
-pub fn bitcoin_units::parse::ParseIntError::clone(&self) -> bitcoin_units::parse::ParseIntError
-pub fn bitcoin_units::parse::ParseIntError::eq(&self, other: &bitcoin_units::parse::ParseIntError) -> bool
-pub fn bitcoin_units::parse::ParseIntError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::PrefixedHexError::clone(&self) -> bitcoin_units::parse::PrefixedHexError
-pub fn bitcoin_units::parse::PrefixedHexError::eq(&self, other: &bitcoin_units::parse::PrefixedHexError) -> bool
-pub fn bitcoin_units::parse::PrefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::PrefixedHexError::from(e: bitcoin_units::parse::ParseIntError) -> Self
-pub fn bitcoin_units::parse::PrefixedHexError::from(never: core::convert::Infallible) -> Self
-pub fn bitcoin_units::parse::UnprefixedHexError::clone(&self) -> bitcoin_units::parse::UnprefixedHexError
-pub fn bitcoin_units::parse::UnprefixedHexError::eq(&self, other: &bitcoin_units::parse::UnprefixedHexError) -> bool
-pub fn bitcoin_units::parse::UnprefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
-pub fn bitcoin_units::parse::UnprefixedHexError::from(e: bitcoin_units::parse::ParseIntError) -> Self
-pub fn bitcoin_units::parse::UnprefixedHexError::from(never: core::convert::Infallible) -> Self
-pub fn bitcoin_units::parse::hex_check_unprefixed(s: &str) -> core::result::Result<&str, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::hex_remove_prefix(s: &str) -> core::result::Result<&str, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u128(s: &str) -> core::result::Result<u128, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u128_prefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u128_unchecked(s: &str) -> core::result::Result<u128, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u128_unprefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::hex_u32(s: &str) -> core::result::Result<u32, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u32_prefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse::PrefixedHexError>
-pub fn bitcoin_units::parse::hex_u32_unchecked(s: &str) -> core::result::Result<u32, bitcoin_units::parse::ParseIntError>
-pub fn bitcoin_units::parse::hex_u32_unprefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse::UnprefixedHexError>
-pub fn bitcoin_units::parse::int_from_str<T: bitcoin_units::parse::Integer>(s: &str) -> core::result::Result<T, bitcoin_units::parse::ParseIntError>
+pub fn bitcoin_units::parse_int::ParseIntError::as_ref(&self) -> &core::num::error::ParseIntError
+pub fn bitcoin_units::parse_int::ParseIntError::clone(&self) -> bitcoin_units::parse_int::ParseIntError
+pub fn bitcoin_units::parse_int::ParseIntError::eq(&self, other: &bitcoin_units::parse_int::ParseIntError) -> bool
+pub fn bitcoin_units::parse_int::ParseIntError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::PrefixedHexError::clone(&self) -> bitcoin_units::parse_int::PrefixedHexError
+pub fn bitcoin_units::parse_int::PrefixedHexError::eq(&self, other: &bitcoin_units::parse_int::PrefixedHexError) -> bool
+pub fn bitcoin_units::parse_int::PrefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::PrefixedHexError::from(e: bitcoin_units::parse_int::ParseIntError) -> Self
+pub fn bitcoin_units::parse_int::PrefixedHexError::from(never: core::convert::Infallible) -> Self
+pub fn bitcoin_units::parse_int::UnprefixedHexError::clone(&self) -> bitcoin_units::parse_int::UnprefixedHexError
+pub fn bitcoin_units::parse_int::UnprefixedHexError::eq(&self, other: &bitcoin_units::parse_int::UnprefixedHexError) -> bool
+pub fn bitcoin_units::parse_int::UnprefixedHexError::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
+pub fn bitcoin_units::parse_int::UnprefixedHexError::from(e: bitcoin_units::parse_int::ParseIntError) -> Self
+pub fn bitcoin_units::parse_int::UnprefixedHexError::from(never: core::convert::Infallible) -> Self
+pub fn bitcoin_units::parse_int::hex_check_unprefixed(s: &str) -> core::result::Result<&str, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::hex_remove_prefix(s: &str) -> core::result::Result<&str, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u128(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u128_prefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u128_unchecked(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u128_unprefixed(s: &str) -> core::result::Result<u128, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u32(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u32_prefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::PrefixedHexError>
+pub fn bitcoin_units::parse_int::hex_u32_unchecked(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::ParseIntError>
+pub fn bitcoin_units::parse_int::hex_u32_unprefixed(s: &str) -> core::result::Result<u32, bitcoin_units::parse_int::UnprefixedHexError>
+pub fn bitcoin_units::parse_int::int_from_str<T: bitcoin_units::parse_int::Integer>(s: &str) -> core::result::Result<T, bitcoin_units::parse_int::ParseIntError>
pub fn bitcoin_units::result::MathOp::clone(&self) -> bitcoin_units::result::MathOp
pub fn bitcoin_units::result::MathOp::eq(&self, other: &bitcoin_units::result::MathOp) -> bool
pub fn bitcoin_units::result::MathOp::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
@@ -1990,10 +1990,10 @@ pub fn bitcoin_units::sequence::Sequence::from(lt: bitcoin_units::locktime::rela
pub fn bitcoin_units::sequence::Sequence::from_512_second_intervals(intervals: u16) -> Self
pub fn bitcoin_units::sequence::Sequence::from_consensus(n: u32) -> Self
pub fn bitcoin_units::sequence::Sequence::from_height(height: u16) -> Self
-pub fn bitcoin_units::sequence::Sequence::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::PrefixedHexError>
+pub fn bitcoin_units::sequence::Sequence::from_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::PrefixedHexError>
pub fn bitcoin_units::sequence::Sequence::from_seconds_ceil(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
pub fn bitcoin_units::sequence::Sequence::from_seconds_floor(seconds: u32) -> core::result::Result<Self, bitcoin_units::locktime::relative::error::TimeOverflowError>
-pub fn bitcoin_units::sequence::Sequence::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse::UnprefixedHexError>
+pub fn bitcoin_units::sequence::Sequence::from_unprefixed_hex(s: &str) -> core::result::Result<Self, bitcoin_units::parse_int::UnprefixedHexError>
pub fn bitcoin_units::sequence::Sequence::hash<__H: core::hash::Hasher>(&self, state: &mut __H)
pub fn bitcoin_units::sequence::Sequence::is_final(self) -> bool
pub fn bitcoin_units::sequence::Sequence::is_height_locked(self) -> bool
@@ -2003,7 +2003,7 @@ pub fn bitcoin_units::sequence::Sequence::is_time_locked(self) -> bool
pub fn bitcoin_units::sequence::Sequence::partial_cmp(&self, other: &bitcoin_units::sequence::Sequence) -> core::option::Option<core::cmp::Ordering>
pub fn bitcoin_units::sequence::Sequence::to_consensus_u32(self) -> u32
pub fn bitcoin_units::sequence::Sequence::to_relative_lock_time(self) -> core::option::Option<bitcoin_units::locktime::relative::LockTime>
-pub fn core::num::error::ParseIntError::from(value: bitcoin_units::parse::ParseIntError) -> Self
+pub fn core::num::error::ParseIntError::from(value: bitcoin_units::parse_int::ParseIntError) -> Self
pub fn i64::mul(self, rhs: &bitcoin_units::SignedAmount) -> Self::Output
pub fn i64::mul(self, rhs: &bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>) -> Self::Output
pub fn i64::mul(self, rhs: bitcoin_units::SignedAmount) -> Self::Output
@@ -2033,7 +2033,7 @@ pub mod bitcoin_units::locktime::absolute
pub mod bitcoin_units::locktime::absolute::error
pub mod bitcoin_units::locktime::relative
pub mod bitcoin_units::locktime::relative::error
-pub mod bitcoin_units::parse
+pub mod bitcoin_units::parse_int
pub mod bitcoin_units::relative
pub mod bitcoin_units::relative::error
pub mod bitcoin_units::result
@@ -2099,8 +2099,8 @@ pub struct bitcoin_units::locktime::relative::error::DisabledLockTimeError(_)
pub struct bitcoin_units::locktime::relative::error::InvalidHeightError
pub struct bitcoin_units::locktime::relative::error::InvalidTimeError
pub struct bitcoin_units::locktime::relative::error::TimeOverflowError
-pub struct bitcoin_units::parse::PrefixedHexError(_)
-pub struct bitcoin_units::parse::UnprefixedHexError(_)
+pub struct bitcoin_units::parse_int::PrefixedHexError(_)
+pub struct bitcoin_units::parse_int::UnprefixedHexError(_)
pub struct bitcoin_units::relative::DisabledLockTimeError(_)
pub struct bitcoin_units::relative::InvalidHeightError
pub struct bitcoin_units::relative::InvalidTimeError
@@ -2114,7 +2114,7 @@ pub struct bitcoin_units::relative::error::TimeOverflowError
pub struct bitcoin_units::sequence::Sequence(pub u32)
pub struct bitcoin_units::time::BlockTime(_)
pub struct bitcoin_units::weight::Weight(_)
-pub trait bitcoin_units::parse::Integer: core::str::traits::FromStr<Err = core::num::error::ParseIntError> + core::convert::TryFrom<i8> + core::marker::Sized + bitcoin_units::parse::sealed::Sealed
+pub trait bitcoin_units::parse_int::Integer: core::str::traits::FromStr<Err = core::num::error::ParseIntError> + core::convert::TryFrom<i8> + core::marker::Sized + bitcoin_units::parse_int::sealed::Sealed
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Add<bitcoin_units::result::NumOpResult<bitcoin_units::Amount>>>::Output
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Add>::Output
pub type &bitcoin_units::Amount::Output = <bitcoin_units::Amount as core::ops::arith::Div<bitcoin_units::FeeRate>>::Output
@@ -2225,8 +2225,8 @@ pub type bitcoin_units::SignedAmount::Output = <bitcoin_units::SignedAmount as c
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::SignedAmount
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::result::NumOpResult<bitcoin_units::SignedAmount>
pub type bitcoin_units::SignedAmount::Output = bitcoin_units::result::NumOpResult<i64>
-pub type bitcoin_units::Weight::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::Weight::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::Weight::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::Weight::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Add>::Output
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Div<core::num::nonzero::NonZero<u64>>>::Output
pub type bitcoin_units::Weight::Output = <bitcoin_units::Weight as core::ops::arith::Div<u64>>::Output
@@ -2241,44 +2241,44 @@ pub type bitcoin_units::Weight::Output = bitcoin_units::Weight
pub type bitcoin_units::Weight::Output = bitcoin_units::result::NumOpResult<bitcoin_units::Amount>
pub type bitcoin_units::Weight::Output = u64
pub type bitcoin_units::amount::Denomination::Err = bitcoin_units::amount::error::ParseDenominationError
-pub type bitcoin_units::block::BlockHeight::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockHeight::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockHeight::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockHeight::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Add<bitcoin_units::block::BlockHeightInterval>>::Output
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Sub<bitcoin_units::block::BlockHeightInterval>>::Output
pub type bitcoin_units::block::BlockHeight::Output = <bitcoin_units::block::BlockHeight as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockHeight::Output = bitcoin_units::block::BlockHeight
pub type bitcoin_units::block::BlockHeight::Output = bitcoin_units::block::BlockHeightInterval
-pub type bitcoin_units::block::BlockHeightInterval::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockHeightInterval::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockHeightInterval::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockHeightInterval::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockHeightInterval::Output = <bitcoin_units::block::BlockHeightInterval as core::ops::arith::Add>::Output
pub type bitcoin_units::block::BlockHeightInterval::Output = <bitcoin_units::block::BlockHeightInterval as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockHeightInterval::Output = bitcoin_units::block::BlockHeightInterval
-pub type bitcoin_units::block::BlockMtp::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockMtp::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockMtp::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockMtp::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Add<bitcoin_units::block::BlockMtpInterval>>::Output
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Sub<bitcoin_units::block::BlockMtpInterval>>::Output
pub type bitcoin_units::block::BlockMtp::Output = <bitcoin_units::block::BlockMtp as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockMtp::Output = bitcoin_units::block::BlockMtp
pub type bitcoin_units::block::BlockMtp::Output = bitcoin_units::block::BlockMtpInterval
-pub type bitcoin_units::block::BlockMtpInterval::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::block::BlockMtpInterval::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::block::BlockMtpInterval::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::block::BlockMtpInterval::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::block::BlockMtpInterval::Output = <bitcoin_units::block::BlockMtpInterval as core::ops::arith::Add>::Output
pub type bitcoin_units::block::BlockMtpInterval::Output = <bitcoin_units::block::BlockMtpInterval as core::ops::arith::Sub>::Output
pub type bitcoin_units::block::BlockMtpInterval::Output = bitcoin_units::block::BlockMtpInterval
pub type bitcoin_units::locktime::absolute::Height::Err = bitcoin_units::locktime::absolute::error::ParseHeightError
pub type bitcoin_units::locktime::absolute::Height::Error = bitcoin_units::locktime::absolute::error::ConversionError
pub type bitcoin_units::locktime::absolute::Height::Error = bitcoin_units::locktime::absolute::error::ParseHeightError
-pub type bitcoin_units::locktime::absolute::LockTime::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::absolute::LockTime::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::absolute::LockTime::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::absolute::LockTime::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Err = bitcoin_units::locktime::absolute::error::ParseTimeError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Error = bitcoin_units::locktime::absolute::error::ConversionError
pub type bitcoin_units::locktime::absolute::MedianTimePast::Error = bitcoin_units::locktime::absolute::error::ParseTimeError
pub type bitcoin_units::locktime::relative::LockTime::Error = bitcoin_units::locktime::relative::error::DisabledLockTimeError
-pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Err = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Error = bitcoin_units::parse::ParseIntError
-pub type bitcoin_units::locktime::relative::NumberOfBlocks::Err = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Err = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOf512Seconds::Error = bitcoin_units::parse_int::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOfBlocks::Err = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::block::TooBigForRelativeHeightError
-pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::parse::ParseIntError
+pub type bitcoin_units::locktime::relative::NumberOfBlocks::Error = bitcoin_units::parse_int::ParseIntError
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Add<T>>::Output
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Add>::Output
pub type bitcoin_units::result::NumOpResult<T>::Output = <bitcoin_units::result::NumOpResult<T> as core::ops::arith::Sub<T>>::Output
diff --git a/bitcoin/src/blockdata/script/witness_version.rs b/bitcoin/src/blockdata/script/witness_version.rs
index 1ad5b38f..f77a38d3 100644
--- a/bitcoin/src/blockdata/script/witness_version.rs
+++ b/bitcoin/src/blockdata/script/witness_version.rs
@@ -15,7 +15,7 @@ use internals::write_err;
use crate::opcodes::all::*;
use crate::opcodes::Opcode;
-use crate::parse::{self, ParseIntError};
+use crate::parse_int::{self, ParseIntError};
use crate::script::Instruction;
/// Version of the segregated witness program.
@@ -82,7 +82,7 @@ impl FromStr for WitnessVersion {
type Err = FromStrError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
- let version: u8 = parse::int_from_str(s)?;
+ let version: u8 = parse_int::int_from_str(s)?;
Ok(WitnessVersion::try_from(version)?)
}
}
diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs
index 318d9fa7..bb94b948 100644
--- a/bitcoin/src/blockdata/transaction.rs
+++ b/bitcoin/src/blockdata/transaction.rs
@@ -1246,13 +1246,13 @@ impl<'a> Arbitrary<'a> for InputWeightPrediction {
mod tests {
use hex::FromHex;
use hex_lit::hex;
- use units::parse;
use super::*;
use crate::consensus::encode::{deserialize, serialize};
use crate::constants::WITNESS_SCALE_FACTOR;
use crate::script::ScriptSigBuf;
use crate::sighash::EcdsaSighashType;
+ use crate::parse_int;
const SOME_TX: &str = "0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000";
@@ -1310,7 +1310,7 @@ mod tests {
assert_eq!(
"5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456:lol"
.parse::<OutPoint>(),
- Err(ParseOutPointError::Vout(parse::int_from_str::<u32>("lol").unwrap_err()))
+ Err(ParseOutPointError::Vout(parse_int::int_from_str::<u32>("lol").unwrap_err()))
);
assert_eq!(
diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs
index ecb3fca0..4127af79 100644
--- a/bitcoin/src/lib.rs
+++ b/bitcoin/src/lib.rs
@@ -165,6 +165,7 @@ pub use units::{
amount::{Amount, SignedAmount},
block::{BlockHeight, BlockHeightInterval, BlockMtp, BlockMtpInterval},
fee_rate::FeeRate,
+ parse_int,
time::{self, BlockTime},
weight::Weight,
};
@@ -270,17 +271,6 @@ pub mod amount {
}
}
-/// Unit parsing utilities.
-pub mod parse {
- /// Re-export everything from the [`units::parse`] module.
- #[doc(inline)]
- pub use units::parse::{
- hex_check_unprefixed, hex_remove_prefix, hex_u128, hex_u128_unchecked, hex_u128_unprefixed,
- hex_u32, hex_u32_unchecked, hex_u32_unprefixed, int_from_box, int_from_str,
- int_from_string, ParseIntError, PrefixedHexError, UnprefixedHexError,
- };
-}
-
mod encode_impls {
//! Encodable/Decodable implementations.
// While we are deprecating, re-exporting, and generally moving things around just put these here.
diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs
index eda6329a..f5bb693b 100644
--- a/bitcoin/src/pow.rs
+++ b/bitcoin/src/pow.rs
@@ -10,7 +10,7 @@ use core::{cmp, fmt};
use internals::impl_to_hex_from_lower_hex;
use io::{BufRead, Write};
-use units::parse::{self, ParseIntError, PrefixedHexError, UnprefixedHexError};
+use units::parse_int::{self, ParseIntError, PrefixedHexError, UnprefixedHexError};
use crate::block::{BlockHash, Header};
use crate::consensus::encode::{self, Decodable, Encodable};
@@ -337,13 +337,13 @@ internal_macros::define_extension_trait! {
pub trait CompactTargetExt impl for CompactTarget {
/// Constructs a new `CompactTarget` from a prefixed hex string.
fn from_hex(s: &str) -> Result<CompactTarget, PrefixedHexError> {
- let target = parse::hex_u32_prefixed(s)?;
+ let target = parse_int::hex_u32_prefixed(s)?;
Ok(Self::from_consensus(target))
}
/// Constructs a new `CompactTarget` from an unprefixed hex string.
fn from_unprefixed_hex(s: &str) -> Result<CompactTarget, UnprefixedHexError> {
- let target = parse::hex_u32_unprefixed(s)?;
+ let target = parse_int::hex_u32_unprefixed(s)?;
Ok(Self::from_consensus(target))
}
@@ -465,28 +465,28 @@ impl U256 {
/// Constructs a new `U256` from a prefixed hex string.
fn from_hex(s: &str) -> Result<Self, PrefixedHexError> {
- let checked = parse::hex_remove_prefix(s)?;
+ let checked = parse_int::hex_remove_prefix(s)?;
Ok(U256::from_hex_internal(checked)?)
}
/// Constructs a new `U256` from an unprefixed hex string.
fn from_unprefixed_hex(s: &str) -> Result<Self, UnprefixedHexError> {
- let checked = parse::hex_check_unprefixed(s)?;
+ let checked = parse_int::hex_check_unprefixed(s)?;
Ok(U256::from_hex_internal(checked)?)
}
// Caller to ensure `s` does not contain a prefix.
fn from_hex_internal(s: &str) -> Result<Self, ParseIntError> {
let (high, low) = if s.len() <= 32 {
- let low = parse::hex_u128_unchecked(s)?;
+ let low = parse_int::hex_u128_unchecked(s)?;
(0, low)
} else {
let high_len = s.len() - 32;
let high_s = &s[..high_len];
let low_s = &s[high_len..];
- let high = parse::hex_u128_unchecked(high_s)?;
- let low = parse::hex_u128_unchecked(low_s)?;
+ let high = parse_int::hex_u128_unchecked(high_s)?;
+ let low = parse_int::hex_u128_unchecked(low_s)?;
(high, low)
};
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index 7877d73d..91b0356b 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -57,7 +57,7 @@ pub use units::{
block::{BlockHeight, BlockHeightInterval, BlockMtp, BlockMtpInterval},
fee_rate::{self, FeeRate},
locktime::{self, absolute, relative},
- parse,
+ parse_int,
result::{self, NumOpResult},
sequence::{self, Sequence},
time::{self, BlockTime},
diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs
index 354ff75c..8aeea36b 100644
--- a/primitives/src/transaction.rs
+++ b/primitives/src/transaction.rs
@@ -27,7 +27,7 @@ use internals::write_err;
#[cfg(feature = "alloc")]
use units::locktime::absolute;
#[cfg(feature = "hex")]
-use units::parse;
+use units::parse_int;
#[cfg(feature = "alloc")]
use units::sequence::Sequence;
#[cfg(feature = "alloc")]
@@ -424,7 +424,7 @@ fn parse_vout(s: &str) -> Result<u32, ParseOutPointError> {
return Err(ParseOutPointError::VoutNotCanonical);
}
}
- parse::int_from_str(s).map_err(ParseOutPointError::Vout)
+ parse_int::int_from_str(s).map_err(ParseOutPointError::Vout)
}
/// An error in parsing an [`OutPoint`].
@@ -436,7 +436,7 @@ pub enum ParseOutPointError {
/// Error in TXID part.
Txid(hex::HexToArrayError),
/// Error in vout part.
- Vout(parse::ParseIntError),
+ Vout(parse_int::ParseIntError),
/// Error in general format.
Format,
/// Size exceeds max.
diff --git a/units/src/block.rs b/units/src/block.rs
index be206550..7b830009 100644
--- a/units/src/block.rs
+++ b/units/src/block.rs
@@ -34,7 +34,7 @@ macro_rules! impl_u32_wrapper {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) }
}
- crate::parse::impl_parse_str_from_int_infallible!($newtype, u32, from);
+ crate::parse_int::impl_parse_str_from_int_infallible!($newtype, u32, from);
impl From<u32> for $newtype {
fn from(inner: u32) -> Self { Self::from_u32(inner) }
diff --git a/units/src/lib.rs b/units/src/lib.rs
index 72acdc7d..0715e606 100644
--- a/units/src/lib.rs
+++ b/units/src/lib.rs
@@ -49,7 +49,7 @@ pub mod amount;
pub mod block;
pub mod fee_rate;
pub mod locktime;
-pub mod parse;
+pub mod parse_int;
pub mod result;
pub mod sequence;
pub mod time;
diff --git a/units/src/locktime/absolute/error.rs b/units/src/locktime/absolute/error.rs
index 925d7105..7474b8ac 100644
--- a/units/src/locktime/absolute/error.rs
+++ b/units/src/locktime/absolute/error.rs
@@ -8,7 +8,7 @@ use core::fmt;
use internals::error::InputString;
use super::{Height, MedianTimePast, LOCK_TIME_THRESHOLD};
-use crate::parse::ParseIntError;
+use crate::parse_int::ParseIntError;
/// Tried to satisfy a lock-by-time lock using a height value.
#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/units/src/locktime/absolute/mod.rs b/units/src/locktime/absolute/mod.rs
index f1a6fa27..6a19fd6d 100644
--- a/units/src/locktime/absolute/mod.rs
+++ b/units/src/locktime/absolute/mod.rs
@@ -17,7 +17,7 @@ use internals::error::InputString;
use self::error::ParseError;
#[cfg(doc)]
use crate::absolute;
-use crate::parse::{self, PrefixedHexError, UnprefixedHexError};
+use crate::parse_int::{self, PrefixedHexError, UnprefixedHexError};
#[rustfmt::skip] // Keep public re-exports separate.
#[doc(no_inline)]
@@ -120,16 +120,16 @@ impl LockTime {
/// # Examples
///
/// ```
- /// # use bitcoin_units::{absolute, parse};
+ /// # use bitcoin_units::{absolute, parse_int};
/// let hex_str = "0x61cf9980"; // Unix timestamp for January 1, 2022
/// let lock_time = absolute::LockTime::from_hex(hex_str)?;
/// assert_eq!(lock_time.to_consensus_u32(), 0x61cf9980);
///
- /// # Ok::<_, parse::PrefixedHexError>(())
+ /// # Ok::<_, parse_int::PrefixedHexError>(())
/// ```
#[inline]
pub fn from_hex(s: &str) -> Result<Self, PrefixedHexError> {
- let lock_time = parse::hex_u32_prefixed(s)?;
+ let lock_time = parse_int::hex_u32_prefixed(s)?;
Ok(Self::from_consensus(lock_time))
}
@@ -143,16 +143,16 @@ impl LockTime {
/// # Examples
///
/// ```
- /// # use bitcoin_units::{absolute, parse};
+ /// # use bitcoin_units::{absolute, parse_int};
/// let hex_str = "61cf9980"; // Unix timestamp for January 1, 2022
/// let lock_time = absolute::LockTime::from_unprefixed_hex(hex_str)?;
/// assert_eq!(lock_time.to_consensus_u32(), 0x61cf9980);
///
- /// # Ok::<_, parse::UnprefixedHexError>(())
+ /// # Ok::<_, parse_int::UnprefixedHexError>(())
/// ```
#[inline]
pub fn from_unprefixed_hex(s: &str) -> Result<Self, UnprefixedHexError> {
- let lock_time = parse::hex_u32_unprefixed(s)?;
+ let lock_time = parse_int::hex_u32_unprefixed(s)?;
Ok(Self::from_consensus(lock_time))
}
@@ -399,7 +399,7 @@ impl LockTime {
}
}
-parse::impl_parse_str_from_int_infallible!(LockTime, u32, from_consensus);
+parse_int::impl_parse_str_from_int_infallible!(LockTime, u32, from_consensus);
impl From<Height> for LockTime {
#[inline]
@@ -546,7 +546,7 @@ impl fmt::Display for Height {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) }
}
-parse::impl_parse_str!(Height, ParseHeightError, parser(Height::from_u32));
+parse_int::impl_parse_str!(Height, ParseHeightError, parser(Height::from_u32));
#[deprecated(since = "TBD", note = "use `MedianTimePast` instead")]
#[doc(hidden)]
@@ -661,7 +661,7 @@ impl fmt::Display for MedianTimePast {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) }
}
-parse::impl_parse_str!(MedianTimePast, ParseTimeError, parser(MedianTimePast::from_u32));
+parse_int::impl_parse_str!(MedianTimePast, ParseTimeError, parser(MedianTimePast::from_u32));
fn parser<T, E, S, F>(f: F) -> impl FnOnce(S) -> Result<T, E>
where
@@ -682,7 +682,7 @@ where
S: AsRef<str> + Into<InputString>,
F: FnOnce(u32) -> Result<T, ConversionError>,
{
- let n = i64::from_str_radix(parse::hex_remove_optional_prefix(s.as_ref()), 16)
+ let n = i64::from_str_radix(parse_int::hex_remove_optional_prefix(s.as_ref()), 16)
.map_err(ParseError::invalid_int(s))?;
let n = u32::try_from(n).map_err(|_| ParseError::Conversion(n))?;
f(n).map_err(ParseError::from).map_err(Into::into)
diff --git a/units/src/locktime/relative/mod.rs b/units/src/locktime/relative/mod.rs
index ef348022..41ee2b42 100644
--- a/units/src/locktime/relative/mod.rs
+++ b/units/src/locktime/relative/mod.rs
@@ -16,7 +16,7 @@ use internals::const_casts;
#[cfg(doc)]
use crate::relative;
-use crate::{parse, BlockHeight, BlockMtp, Sequence};
+use crate::{parse_int, BlockHeight, BlockMtp, Sequence};
#[rustfmt::skip] // Keep public re-exports separate.
#[doc(no_inline)]
@@ -473,7 +473,7 @@ impl From<u16> for NumberOfBlocks {
fn from(value: u16) -> Self { NumberOfBlocks(value) }
}
-parse::impl_parse_str_from_int_infallible!(NumberOfBlocks, u16, from);
+parse_int::impl_parse_str_from_int_infallible!(NumberOfBlocks, u16, from);
impl fmt::Display for NumberOfBlocks {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) }
@@ -587,7 +587,7 @@ impl NumberOf512Seconds {
}
}
-parse::impl_parse_str_from_int_infallible!(NumberOf512Seconds, u16, from_512_second_intervals);
+parse_int::impl_parse_str_from_int_infallible!(NumberOf512Seconds, u16, from_512_second_intervals);
impl fmt::Display for NumberOf512Seconds {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) }
diff --git a/units/src/parse.rs b/units/src/parse.rs
deleted file mode 100644
index ed33890e..00000000
--- a/units/src/parse.rs
+++ /dev/null
@@ -1,647 +0,0 @@
-// SPDX-License-Identifier: CC0-1.0
-
-//! Parsing utilities.
-
-use core::convert::Infallible;
-use core::fmt;
-use core::str::FromStr;
-
-use internals::error::InputString;
-use internals::write_err;
-
-/// Error with rich context returned when a string can't be parsed as an integer.
-///
-/// This is an extension of [`core::num::ParseIntError`], which carries the input that failed to
-/// parse as well as type information. As a result it provides very informative error messages that
-/// make it easier to understand the problem and correct mistakes.
-///
-/// Note that this is larger than the type from `core` so if it's passed through a deep call stack
-/// in a performance-critical application you may want to box it or throw away the context by
-/// converting to `core` type.
-#[derive(Debug, Clone, PartialEq, Eq)]
-#[non_exhaustive]
-pub struct ParseIntError {
- pub(crate) input: InputString,
- // for displaying - see Display impl with nice error message below
- pub(crate) bits: u8,
- // We could represent this as a single bit, but it wouldn't actually decrease the cost of moving
- // the struct because String contains pointers so there will be padding of bits at least
- // pointer_size - 1 bytes: min 1B in practice.
- pub(crate) is_signed: bool,
- pub(crate) source: core::num::ParseIntError,
-}
-
-impl fmt::Display for ParseIntError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let signed = if self.is_signed { "signed" } else { "unsigned" };
- write_err!(f, "{} ({}, {}-bit)", self.input.display_cannot_parse("integer"), signed, self.bits; self.source)
- }
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for ParseIntError {
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.source) }
-}
-
-impl From<ParseIntError> for core::num::ParseIntError {
- fn from(value: ParseIntError) -> Self { value.source }
-}
-
-impl AsRef<core::num::ParseIntError> for ParseIntError {
- fn as_ref(&self) -> &core::num::ParseIntError { &self.source }
-}
-
-/// Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally
-/// passes non-integer to the `parse()` function.
-// This trait is not dyn-compatible because `FromStr` is not dyn-compatible.
-pub trait Integer:
- FromStr<Err = core::num::ParseIntError> + TryFrom<i8> + Sized + sealed::Sealed
-{
-}
-
-macro_rules! impl_integer {
- ($($type:ty),* $(,)?) => {
- $(
- impl Integer for $type {}
- impl sealed::Sealed for $type {}
- )*
- }
-}
-
-impl_integer!(u8, i8, u16, i16, u32, i32, u64, i64, u128, i128);
-
-mod sealed {
- /// Seals the `Integer` trait.
- pub trait Sealed {}
-}
-
-/// Parses the input string as an integer returning an error carrying rich context.
-///
-/// Apart from the rich error context this function exists so that we can handle builds with and
-/// without an allocator. If an allocator is available (`alloc` feature enabled) then this function
-/// allocates to copy the input string into the error return. If `alloc` is not enabled the input
-/// string is lost.
-///
-/// If the caller has a `String` or `Box<str>` which is not used later it's better to call
-/// [`parse::int_from_string`] or [`parse::int_from_box`] respectively.
-///
-/// [`parse::int_from_string`]: crate::parse::int_from_string
-/// [`parse::int_from_box`]: crate::parse::int_from_box
-///
-/// # Errors
-///
-/// On error this function allocates to copy the input string into the error return.
-pub fn int_from_str<T: Integer>(s: &str) -> Result<T, ParseIntError> { int(s) }
-
-/// Parses the input string as an integer returning an error carrying rich context.
-///
-/// # Errors
-///
-/// On error the input string is moved into the error return without allocating.
-#[cfg(feature = "alloc")]
-pub fn int_from_string<T: Integer>(s: alloc::string::String) -> Result<T, ParseIntError> { int(s) }
-
-/// Parses the input string as an integer returning an error carrying rich context.
-///
-/// # Errors
-///
-/// On error the input string is converted into the error return without allocating.
-#[cfg(feature = "alloc")]
-pub fn int_from_box<T: Integer>(s: alloc::boxed::Box<str>) -> Result<T, ParseIntError> { int(s) }
-
-// This must be private because we do not want `InputString` to appear in the public API.
-fn int<T: Integer, S: AsRef<str> + Into<InputString>>(s: S) -> Result<T, ParseIntError> {
- s.as_ref().parse().map_err(|error| {
- ParseIntError {
- input: s.into(),
- bits: u8::try_from(core::mem::size_of::<T>() * 8).expect("max is 128 bits for u128"),
- // We detect if the type is signed by checking if -1 can be represented by it
- // this way we don't have to implement special traits and optimizer will get rid of the
- // computation.
- is_signed: T::try_from(-1i8).is_ok(),
- source: error,
- }
- })
-}
-
-/// Implements standard parsing traits for `$type` by calling `parse::int`.
-///
-/// Once the string is converted to an integer the infallible conversion function `fn` is used to
-/// construct the type `to`.
-///
-/// Implements:
-///
-/// * `FromStr`
-/// * `TryFrom<&str>`
-///
-/// And if `alloc` feature is enabled in calling crate:
-///
-/// * `TryFrom<Box<str>>`
-/// * `TryFrom<String>`
-///
-/// # Parameters
-///
-/// * `to` - the type converted to e.g., `impl From<&str> for $to`.
-/// * `err` - the error type returned by `$inner_fn` (implies returned by `FromStr` and `TryFrom`).
-/// * `fn`: the infallible conversion function to call to convert from an integer.
-///
-/// # Errors
-///
-/// If parsing the string fails then a `units::parse::ParseIntError` is returned.
-macro_rules! impl_parse_str_from_int_infallible {
- ($to:ident, $inner:ident, $fn:ident) => {
- impl $crate::_export::_core::str::FromStr for $to {
- type Err = $crate::parse::ParseIntError;
-
- fn from_str(s: &str) -> $crate::_export::_core::result::Result<Self, Self::Err> {
- $crate::_export::_core::convert::TryFrom::try_from(s)
- }
- }
-
- impl $crate::_export::_core::convert::TryFrom<&str> for $to {
- type Error = $crate::parse::ParseIntError;
-
- fn try_from(s: &str) -> $crate::_export::_core::result::Result<Self, Self::Error> {
- $crate::parse::int_from_str::<$inner>(s).map($to::$fn)
- }
- }
-
- #[cfg(feature = "alloc")]
- impl $crate::_export::_core::convert::TryFrom<alloc::string::String> for $to {
- type Error = $crate::parse::ParseIntError;
-
- fn try_from(
- s: alloc::string::String,
- ) -> $crate::_export::_core::result::Result<Self, Self::Error> {
- $crate::parse::int_from_string::<$inner>(s).map($to::$fn)
- }
- }
-
- #[cfg(feature = "alloc")]
- impl $crate::_export::_core::convert::TryFrom<alloc::boxed::Box<str>> for $to {
- type Error = $crate::parse::ParseIntError;
-
- fn try_from(
- s: alloc::boxed::Box<str>,
- ) -> $crate::_export::_core::result::Result<Self, Self::Error> {
- $crate::parse::int_from_box::<$inner>(s).map($to::$fn)
- }
- }
- };
-}
-pub(crate) use impl_parse_str_from_int_infallible;
-
-/// Implements standard parsing traits for `$type` by calling through to `$inner_fn`.
-///
-/// Implements:
-///
-/// * `FromStr`
-/// * `TryFrom<&str>`
-///
-/// And if `alloc` feature is enabled in calling crate:
-///
-/// * `TryFrom<Box<str>>`
-/// * `TryFrom<String>`
-///
-/// # Parameters
-///
-/// * `to` - the type converted to e.g., `impl From<&str> for $to`.
-/// * `err` - the error type returned by `$inner_fn` (implies returned by `FromStr` and `TryFrom`).
-/// * `inner_fn`: the fallible conversion function to call to convert from a string reference.
-///
-/// # Errors
-///
-/// All functions use the error returned by `$inner_fn`.
-macro_rules! impl_parse_str {
- ($to:ty, $err:ty, $inner_fn:expr) => {
- $crate::parse::impl_tryfrom_str!(&str, $to, $err, $inner_fn);
- #[cfg(feature = "alloc")]
- $crate::parse::impl_tryfrom_str!(alloc::string::String, $to, $err, $inner_fn; alloc::boxed::Box<str>, $to, $err, $inner_fn);
-
- impl $crate::_export::_core::str::FromStr for $to {
- type Err = $err;
-
- fn from_str(s: &str) -> $crate::_export::_core::result::Result<Self, Self::Err> {
- $inner_fn(s)
- }
- }
- }
-}
-pub(crate) use impl_parse_str;
-
-/// Implements `TryFrom<$from> for $to`.
-macro_rules! impl_tryfrom_str {
- ($($from:ty, $to:ty, $err:ty, $inner_fn:expr);*) => {
- $(
- impl $crate::_export::_core::convert::TryFrom<$from> for $to {
- type Error = $err;
-
- fn try_from(s: $from) -> $crate::_export::_core::result::Result<Self, Self::Error> {
- $inner_fn(s)
- }
- }
- )*
- }
-}
-pub(crate) use impl_tryfrom_str;
-
-/// Removes the prefix `0x` (or `0X`) from a hex string.
-///
-/// # Errors
-///
-/// If the input string does not contain a prefix.
-pub fn hex_remove_prefix(s: &str) -> Result<&str, PrefixedHexError> {
- if let Some(checked) = s.strip_prefix("0x") {
- Ok(checked)
- } else if let Some(checked) = s.strip_prefix("0X") {
- Ok(checked)
- } else {
- Err(MissingPrefixError::new(s).into())
- }
-}
-
-/// Checks a hex string does not have a prefix `0x` (or `0X`).
-///
-/// # Errors
-///
-/// If the input string contains a prefix.
-pub fn hex_check_unprefixed(s: &str) -> Result<&str, UnprefixedHexError> {
- if s.starts_with("0x") || s.starts_with("0X") {
- return Err(ContainsPrefixError::new(s).into());
- }
- Ok(s)
-}
-
-/// Parses a `u32` from a hex string.
-///
-/// Input string may or may not contain a `0x` (or `0X`) prefix.
-///
-/// # Errors
-///
-/// If the input string is not a valid hex encoding of a `u32`.
-pub fn hex_u32(s: &str) -> Result<u32, ParseIntError> {
- let unchecked = hex_remove_optional_prefix(s);
- hex_u32_unchecked(unchecked)
-}
-
-/// Parses a `u32` from a prefixed hex string.
-///
-/// # Errors
-///
-/// - If the input string does not contain a `0x` (or `0X`) prefix.
-/// - If the input string is not a valid hex encoding of a `u32`.
-pub fn hex_u32_prefixed(s: &str) -> Result<u32, PrefixedHexError> {
- let checked = hex_remove_prefix(s)?;
- Ok(hex_u32_unchecked(checked)?)
-}
-
-/// Parses a `u32` from an unprefixed hex string.
-///
-/// # Errors
-///
-/// - If the input string contains a `0x` (or `0X`) prefix.
-/// - If the input string is not a valid hex encoding of a `u32`.
-pub fn hex_u32_unprefixed(s: &str) -> Result<u32, UnprefixedHexError> {
- let checked = hex_check_unprefixed(s)?;
- Ok(hex_u32_unchecked(checked)?)
-}
-
-/// Parses a `u32` from an unprefixed hex string without first checking for a prefix.
-///
-/// # Errors
-///
-/// - If the input string contains a `0x` (or `0X`) prefix, returns `InvalidDigit` due to the `x`.
-/// - If the input string is not a valid hex encoding of a `u32`.
-pub fn hex_u32_unchecked(s: &str) -> Result<u32, ParseIntError> {
- u32::from_str_radix(s, 16).map_err(|error| ParseIntError {
- input: s.into(),
- bits: 32,
- is_signed: false,
- source: error,
- })
-}
-
-/// Parses a `u128` from a hex string.
-///
-/// Input string may or may not contain a `0x` (or `0X`) prefix.
-///
-/// # Errors
-///
-/// If the input string is not a valid hex encoding of a `u128`.
-pub fn hex_u128(s: &str) -> Result<u128, ParseIntError> {
- let unchecked = hex_remove_optional_prefix(s);
- hex_u128_unchecked(unchecked)
-}
-
-/// Parses a `u128` from a prefixed hex string.
-///
-/// # Errors
-///
-/// - If the input string does not contain a `0x` (or `0X`) prefix.
-/// - If the input string is not a valid hex encoding of a `u128`.
-pub fn hex_u128_prefixed(s: &str) -> Result<u128, PrefixedHexError> {
- let checked = hex_remove_prefix(s)?;
- Ok(hex_u128_unchecked(checked)?)
-}
-
-/// Parses a `u128` from an unprefixed hex string.
-///
-/// # Errors
-///
-/// - If the input string contains a `0x` (or `0X`) prefix.
-/// - If the input string is not a valid hex encoding of a `u128`.
-pub fn hex_u128_unprefixed(s: &str) -> Result<u128, UnprefixedHexError> {
- let checked = hex_check_unprefixed(s)?;
- Ok(hex_u128_unchecked(checked)?)
-}
-
-/// Parses a `u128` from an unprefixed hex string without first checking for a prefix.
-///
-/// # Errors
-///
-/// - If the input string contains a `0x` (or `0X`) prefix, returns `InvalidDigit` due to the `x`.
-/// - If the input string is not a valid hex encoding of a `u128`.
-pub fn hex_u128_unchecked(s: &str) -> Result<u128, ParseIntError> {
- u128::from_str_radix(s, 16).map_err(|error| ParseIntError {
- input: s.into(),
- bits: 128,
- is_signed: false,
- source: error,
- })
-}
-
-/// Strips the hex prefix off `s` if one is present.
-pub(crate) fn hex_remove_optional_prefix(s: &str) -> &str {
- if let Some(stripped) = s.strip_prefix("0x") {
- stripped
- } else if let Some(stripped) = s.strip_prefix("0X") {
- stripped
- } else {
- s
- }
-}
-
-/// Error returned when parsing an integer from a hex string that is supposed to contain a prefix.
-#[derive(Debug, Clone, Eq, PartialEq)]
-pub struct PrefixedHexError(PrefixedHexErrorInner);
-
-/// Error returned when parsing an integer from a hex string that is supposed to contain a prefix.
-#[derive(Debug, Clone, Eq, PartialEq)]
-enum PrefixedHexErrorInner {
- /// Hex string is missing prefix.
- MissingPrefix(MissingPrefixError),
- /// Error parsing integer from hex string.
- ParseInt(ParseIntError),
-}
-
-impl From<Infallible> for PrefixedHexError {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
-impl From<Infallible> for PrefixedHexErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
-impl fmt::Display for PrefixedHexError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use PrefixedHexErrorInner as E;
-
- match self.0 {
- E::MissingPrefix(ref e) => write_err!(f, "hex string is missing prefix"; e),
- E::ParseInt(ref e) => write_err!(f, "prefixed hex string invalid int"; e),
- }
- }
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for PrefixedHexError {
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- use PrefixedHexErrorInner as E;
-
- match self.0 {
- E::MissingPrefix(ref e) => Some(e),
- E::ParseInt(ref e) => Some(e),
- }
- }
-}
-
-impl From<MissingPrefixError> for PrefixedHexError {
- fn from(e: MissingPrefixError) -> Self { Self(PrefixedHexErrorInner::MissingPrefix(e)) }
-}
-
-impl From<ParseIntError> for PrefixedHexError {
- fn from(e: ParseIntError) -> Self { Self(PrefixedHexErrorInner::ParseInt(e)) }
-}
-
-/// Error returned when parsing an integer from a hex string that is not supposed to contain a prefix.
-#[derive(Debug, Clone, Eq, PartialEq)]
-pub struct UnprefixedHexError(UnprefixedHexErrorInner);
-
-#[derive(Debug, Clone, Eq, PartialEq)]
-enum UnprefixedHexErrorInner {
- /// Hex string contains prefix.
- ContainsPrefix(ContainsPrefixError),
- /// Error parsing integer from string.
- ParseInt(ParseIntError),
-}
-
-impl From<Infallible> for UnprefixedHexError {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
-impl From<Infallible> for UnprefixedHexErrorInner {
- fn from(never: Infallible) -> Self { match never {} }
-}
-
-impl fmt::Display for UnprefixedHexError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use UnprefixedHexErrorInner as E;
-
- match self.0 {
- E::ContainsPrefix(ref e) => write_err!(f, "hex string is contains prefix"; e),
- E::ParseInt(ref e) => write_err!(f, "hex string parse int"; e),
- }
- }
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for UnprefixedHexError {
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- use UnprefixedHexErrorInner as E;
-
- match self.0 {
- E::ContainsPrefix(ref e) => Some(e),
- E::ParseInt(ref e) => Some(e),
- }
- }
-}
-
-impl From<ContainsPrefixError> for UnprefixedHexError {
- fn from(e: ContainsPrefixError) -> Self { Self(UnprefixedHexErrorInner::ContainsPrefix(e)) }
-}
-
-impl From<ParseIntError> for UnprefixedHexError {
- fn from(e: ParseIntError) -> Self { Self(UnprefixedHexErrorInner::ParseInt(e)) }
-}
-
-/// Error returned when a hex string is missing a prefix (e.g. `0x`).
-#[derive(Debug, Clone, Eq, PartialEq)]
-struct MissingPrefixError {
- hex: InputString,
-}
-
-impl MissingPrefixError {
- /// Constructs a new error from the string with the missing prefix.
- pub(crate) fn new(hex: &str) -> Self { Self { hex: hex.into() } }
-}
-
-impl fmt::Display for MissingPrefixError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{} because it is missing the '0x' prefix", self.hex.display_cannot_parse("hex"))
- }
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for MissingPrefixError {}
-
-/// Error when hex string contains a prefix (e.g. 0x).
-#[derive(Debug, Clone, Eq, PartialEq)]
-struct ContainsPrefixError {
- hex: InputString,
-}
-
-impl ContainsPrefixError {
- /// Constructs a new error from the string that contains the prefix.
- pub(crate) fn new(hex: &str) -> Self { Self { hex: hex.into() } }
-}
-
-impl fmt::Display for ContainsPrefixError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{} because it contains the '0x' prefix", self.hex.display_cannot_parse("hex"))
- }
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for ContainsPrefixError {}
-
-#[cfg(test)]
-mod tests {
- #[cfg(feature = "std")]
- use std::panic;
-
- use super::*;
-
- #[test]
- fn parse_int() {
- assert!(int_from_str::<u8>("1").is_ok());
- let _ = int_from_str::<i8>("not a number").map_err(|e| assert!(e.is_signed));
- let _ = int_from_str::<u8>("not a number").map_err(|e| assert!(!e.is_signed));
- }
-
- #[test]
- #[cfg(feature = "std")]
- fn parse_int_panic_when_populating_bits() {
- // Fields in the test type are never used
- #[allow(dead_code)]
- struct TestTypeLargerThanU128(u128, u128);
- impl_integer!(TestTypeLargerThanU128);
- impl FromStr for TestTypeLargerThanU128 {
- type Err = core::num::ParseIntError;
-
- fn from_str(_: &str) -> Result<Self, Self::Err> {
- "Always invalid for testing".parse::<u32>().map(|_| TestTypeLargerThanU128(0, 0))
- }
- }
- impl From<i8> for TestTypeLargerThanU128 {
- fn from(_: i8) -> Self { TestTypeLargerThanU128(0, 0) }
- }
-
- let result = panic::catch_unwind(|| int_from_str::<TestTypeLargerThanU128>("not a number"));
- assert!(result.is_err());
- }
-
- #[test]
- fn remove_prefix() {
- let lower = "0xhello";
- assert_eq!(hex_remove_prefix(lower).unwrap(), "hello");
-
- let upper = "0Xhello";
- assert_eq!(hex_remove_prefix(upper).unwrap(), "hello");
-
- let err = "error";
- assert!(hex_remove_prefix(err).is_err());
- }
-
- #[test]
- fn check_unprefixed() {
- let lower = "0xhello";
- assert!(hex_check_unprefixed(lower).is_err());
-
- let upper = "0Xhello";
- assert!(hex_check_unprefixed(upper).is_err());
-
- let valid = "hello";
- assert_eq!(hex_check_unprefixed(valid).unwrap(), "hello");
- }
-
- #[test]
- fn parse_u32_from_hex_prefixed() {
- let want = 171;
- let got = hex_u32("0xab").expect("failed to parse prefixed hex");
- assert_eq!(got, want);
- }
-
- #[test]
- fn parse_u32_from_hex_no_prefix() {
- let want = 171;
- let got = hex_u32("ab").expect("failed to parse non-prefixed hex");
- assert_eq!(got, want);
- }
-
- #[test]
- fn parse_hex_u32_prefixed() {
- let want = 171; // 0xab
- assert_eq!(hex_u32_prefixed("0xab").unwrap(), want);
- assert!(hex_u32_unprefixed("0xab").is_err());
- }
-
- #[test]
- fn parse_hex_u32_unprefixed() {
- let want = 171; // 0xab
- assert_eq!(hex_u32_unprefixed("ab").unwrap(), want);
- assert!(hex_u32_prefixed("ab").is_err());
- }
-
- #[test]
- fn parse_u128_from_hex_prefixed() {
- let want = 3_735_928_559;
- let got = hex_u128("0xdeadbeef").expect("failed to parse prefixed hex");
- assert_eq!(got, want);
- }
-
- #[test]
- fn parse_u128_from_hex_no_prefix() {
- let want = 3_735_928_559;
- let got = hex_u128("deadbeef").expect("failed to parse non-prefixed hex");
- assert_eq!(got, want);
- }
-
- #[test]
- fn parse_hex_u128_prefixed() {
- let want = 3_735_928_559;
- assert_eq!(hex_u128_prefixed("0xdeadbeef").unwrap(), want);
- assert!(hex_u128_unprefixed("0xdeadbeef").is_err());
- }
-
- #[test]
- fn parse_hex_u128_unprefixed() {
- let want = 3_735_928_559;
- assert_eq!(hex_u128_unprefixed("deadbeef").unwrap(), want);
- assert!(hex_u128_prefixed("deadbeef").is_err());
- }
-
- #[test]
- fn parse_u32_from_hex_unchecked_errors_on_prefix() {
- assert!(hex_u32_unchecked("0xab").is_err());
- }
-}
diff --git a/units/src/parse_int.rs b/units/src/parse_int.rs
new file mode 100644
index 00000000..70cac330
--- /dev/null
+++ b/units/src/parse_int.rs
@@ -0,0 +1,647 @@
+// SPDX-License-Identifier: CC0-1.0
+
+//! Parsing utilities.
+
+use core::convert::Infallible;
+use core::fmt;
+use core::str::FromStr;
+
+use internals::error::InputString;
+use internals::write_err;
+
+/// Error with rich context returned when a string can't be parsed as an integer.
+///
+/// This is an extension of [`core::num::ParseIntError`], which carries the input that failed to
+/// parse as well as type information. As a result it provides very informative error messages that
+/// make it easier to understand the problem and correct mistakes.
+///
+/// Note that this is larger than the type from `core` so if it's passed through a deep call stack
+/// in a performance-critical application you may want to box it or throw away the context by
+/// converting to `core` type.
+#[derive(Debug, Clone, PartialEq, Eq)]
+#[non_exhaustive]
+pub struct ParseIntError {
+ pub(crate) input: InputString,
+ // for displaying - see Display impl with nice error message below
+ pub(crate) bits: u8,
+ // We could represent this as a single bit, but it wouldn't actually decrease the cost of moving
+ // the struct because String contains pointers so there will be padding of bits at least
+ // pointer_size - 1 bytes: min 1B in practice.
+ pub(crate) is_signed: bool,
+ pub(crate) source: core::num::ParseIntError,
+}
+
+impl fmt::Display for ParseIntError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ let signed = if self.is_signed { "signed" } else { "unsigned" };
+ write_err!(f, "{} ({}, {}-bit)", self.input.display_cannot_parse("integer"), signed, self.bits; self.source)
+ }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for ParseIntError {
+ fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.source) }
+}
+
+impl From<ParseIntError> for core::num::ParseIntError {
+ fn from(value: ParseIntError) -> Self { value.source }
+}
+
+impl AsRef<core::num::ParseIntError> for ParseIntError {
+ fn as_ref(&self) -> &core::num::ParseIntError { &self.source }
+}
+
+/// Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally
+/// passes non-integer to the `parse()` function.
+// This trait is not dyn-compatible because `FromStr` is not dyn-compatible.
+pub trait Integer:
+ FromStr<Err = core::num::ParseIntError> + TryFrom<i8> + Sized + sealed::Sealed
+{
+}
+
+macro_rules! impl_integer {
+ ($($type:ty),* $(,)?) => {
+ $(
+ impl Integer for $type {}
+ impl sealed::Sealed for $type {}
+ )*
+ }
+}
+
+impl_integer!(u8, i8, u16, i16, u32, i32, u64, i64, u128, i128);
+
+mod sealed {
+ /// Seals the `Integer` trait.
+ pub trait Sealed {}
+}
+
+/// Parses the input string as an integer returning an error carrying rich context.
+///
+/// Apart from the rich error context this function exists so that we can handle builds with and
+/// without an allocator. If an allocator is available (`alloc` feature enabled) then this function
+/// allocates to copy the input string into the error return. If `alloc` is not enabled the input
+/// string is lost.
+///
+/// If the caller has a `String` or `Box<str>` which is not used later it's better to call
+/// [`parse_int::int_from_string`] or [`parse_int::int_from_box`] respectively.
+///
+/// [`parse_int::int_from_string`]: crate::parse_int::int_from_string
+/// [`parse_int::int_from_box`]: crate::parse_int::int_from_box
+///
+/// # Errors
+///
+/// On error this function allocates to copy the input string into the error return.
+pub fn int_from_str<T: Integer>(s: &str) -> Result<T, ParseIntError> { int(s) }
+
+/// Parses the input string as an integer returning an error carrying rich context.
+///
+/// # Errors
+///
+/// On error the input string is moved into the error return without allocating.
+#[cfg(feature = "alloc")]
+pub fn int_from_string<T: Integer>(s: alloc::string::String) -> Result<T, ParseIntError> { int(s) }
+
+/// Parses the input string as an integer returning an error carrying rich context.
+///
+/// # Errors
+///
+/// On error the input string is converted into the error return without allocating.
+#[cfg(feature = "alloc")]
+pub fn int_from_box<T: Integer>(s: alloc::boxed::Box<str>) -> Result<T, ParseIntError> { int(s) }
+
+// This must be private because we do not want `InputString` to appear in the public API.
+fn int<T: Integer, S: AsRef<str> + Into<InputString>>(s: S) -> Result<T, ParseIntError> {
+ s.as_ref().parse().map_err(|error| {
+ ParseIntError {
+ input: s.into(),
+ bits: u8::try_from(core::mem::size_of::<T>() * 8).expect("max is 128 bits for u128"),
+ // We detect if the type is signed by checking if -1 can be represented by it
+ // this way we don't have to implement special traits and optimizer will get rid of the
+ // computation.
+ is_signed: T::try_from(-1i8).is_ok(),
+ source: error,
+ }
+ })
+}
+
+/// Implements standard parsing traits for `$type` by calling `parse::int`.
+///
+/// Once the string is converted to an integer the infallible conversion function `fn` is used to
+/// construct the type `to`.
+///
+/// Implements:
+///
+/// * `FromStr`
+/// * `TryFrom<&str>`
+///
+/// And if `alloc` feature is enabled in calling crate:
+///
+/// * `TryFrom<Box<str>>`
+/// * `TryFrom<String>`
+///
+/// # Parameters
+///
+/// * `to` - the type converted to e.g., `impl From<&str> for $to`.
+/// * `err` - the error type returned by `$inner_fn` (implies returned by `FromStr` and `TryFrom`).
+/// * `fn`: the infallible conversion function to call to convert from an integer.
+///
+/// # Errors
+///
+/// If parsing the string fails then a `units::parse::ParseIntError` is returned.
+macro_rules! impl_parse_str_from_int_infallible {
+ ($to:ident, $inner:ident, $fn:ident) => {
+ impl $crate::_export::_core::str::FromStr for $to {
+ type Err = $crate::parse_int::ParseIntError;
+
+ fn from_str(s: &str) -> $crate::_export::_core::result::Result<Self, Self::Err> {
+ $crate::_export::_core::convert::TryFrom::try_from(s)
+ }
+ }
+
+ impl $crate::_export::_core::convert::TryFrom<&str> for $to {
+ type Error = $crate::parse_int::ParseIntError;
+
+ fn try_from(s: &str) -> $crate::_export::_core::result::Result<Self, Self::Error> {
+ $crate::parse_int::int_from_str::<$inner>(s).map($to::$fn)
+ }
+ }
+
+ #[cfg(feature = "alloc")]
+ impl $crate::_export::_core::convert::TryFrom<alloc::string::String> for $to {
+ type Error = $crate::parse_int::ParseIntError;
+
+ fn try_from(
+ s: alloc::string::String,
+ ) -> $crate::_export::_core::result::Result<Self, Self::Error> {
+ $crate::parse_int::int_from_string::<$inner>(s).map($to::$fn)
+ }
+ }
+
+ #[cfg(feature = "alloc")]
+ impl $crate::_export::_core::convert::TryFrom<alloc::boxed::Box<str>> for $to {
+ type Error = $crate::parse_int::ParseIntError;
+
+ fn try_from(
+ s: alloc::boxed::Box<str>,
+ ) -> $crate::_export::_core::result::Result<Self, Self::Error> {
+ $crate::parse_int::int_from_box::<$inner>(s).map($to::$fn)
+ }
+ }
+ };
+}
+pub(crate) use impl_parse_str_from_int_infallible;
+
+/// Implements standard parsing traits for `$type` by calling through to `$inner_fn`.
+///
+/// Implements:
+///
+/// * `FromStr`
+/// * `TryFrom<&str>`
+///
+/// And if `alloc` feature is enabled in calling crate:
+///
+/// * `TryFrom<Box<str>>`
+/// * `TryFrom<String>`
+///
+/// # Parameters
+///
+/// * `to` - the type converted to e.g., `impl From<&str> for $to`.
+/// * `err` - the error type returned by `$inner_fn` (implies returned by `FromStr` and `TryFrom`).
+/// * `inner_fn`: the fallible conversion function to call to convert from a string reference.
+///
+/// # Errors
+///
+/// All functions use the error returned by `$inner_fn`.
+macro_rules! impl_parse_str {
+ ($to:ty, $err:ty, $inner_fn:expr) => {
+ $crate::parse_int::impl_tryfrom_str!(&str, $to, $err, $inner_fn);
+ #[cfg(feature = "alloc")]
+ $crate::parse_int::impl_tryfrom_str!(alloc::string::String, $to, $err, $inner_fn; alloc::boxed::Box<str>, $to, $err, $inner_fn);
+
+ impl $crate::_export::_core::str::FromStr for $to {
+ type Err = $err;
+
+ fn from_str(s: &str) -> $crate::_export::_core::result::Result<Self, Self::Err> {
+ $inner_fn(s)
+ }
+ }
+ }
+}
+pub(crate) use impl_parse_str;
+
+/// Implements `TryFrom<$from> for $to`.
+macro_rules! impl_tryfrom_str {
+ ($($from:ty, $to:ty, $err:ty, $inner_fn:expr);*) => {
+ $(
+ impl $crate::_export::_core::convert::TryFrom<$from> for $to {
+ type Error = $err;
+
+ fn try_from(s: $from) -> $crate::_export::_core::result::Result<Self, Self::Error> {
+ $inner_fn(s)
+ }
+ }
+ )*
+ }
+}
+pub(crate) use impl_tryfrom_str;
+
+/// Removes the prefix `0x` (or `0X`) from a hex string.
+///
+/// # Errors
+///
+/// If the input string does not contain a prefix.
+pub fn hex_remove_prefix(s: &str) -> Result<&str, PrefixedHexError> {
+ if let Some(checked) = s.strip_prefix("0x") {
+ Ok(checked)
+ } else if let Some(checked) = s.strip_prefix("0X") {
+ Ok(checked)
+ } else {
+ Err(MissingPrefixError::new(s).into())
+ }
+}
+
+/// Checks a hex string does not have a prefix `0x` (or `0X`).
+///
+/// # Errors
+///
+/// If the input string contains a prefix.
+pub fn hex_check_unprefixed(s: &str) -> Result<&str, UnprefixedHexError> {
+ if s.starts_with("0x") || s.starts_with("0X") {
+ return Err(ContainsPrefixError::new(s).into());
+ }
+ Ok(s)
+}
+
+/// Parses a `u32` from a hex string.
+///
+/// Input string may or may not contain a `0x` (or `0X`) prefix.
+///
+/// # Errors
+///
+/// If the input string is not a valid hex encoding of a `u32`.
+pub fn hex_u32(s: &str) -> Result<u32, ParseIntError> {
+ let unchecked = hex_remove_optional_prefix(s);
+ hex_u32_unchecked(unchecked)
+}
+
+/// Parses a `u32` from a prefixed hex string.
+///
+/// # Errors
+///
+/// - If the input string does not contain a `0x` (or `0X`) prefix.
+/// - If the input string is not a valid hex encoding of a `u32`.
+pub fn hex_u32_prefixed(s: &str) -> Result<u32, PrefixedHexError> {
+ let checked = hex_remove_prefix(s)?;
+ Ok(hex_u32_unchecked(checked)?)
+}
+
+/// Parses a `u32` from an unprefixed hex string.
+///
+/// # Errors
+///
+/// - If the input string contains a `0x` (or `0X`) prefix.
+/// - If the input string is not a valid hex encoding of a `u32`.
+pub fn hex_u32_unprefixed(s: &str) -> Result<u32, UnprefixedHexError> {
+ let checked = hex_check_unprefixed(s)?;
+ Ok(hex_u32_unchecked(checked)?)
+}
+
+/// Parses a `u32` from an unprefixed hex string without first checking for a prefix.
+///
+/// # Errors
+///
+/// - If the input string contains a `0x` (or `0X`) prefix, returns `InvalidDigit` due to the `x`.
+/// - If the input string is not a valid hex encoding of a `u32`.
+pub fn hex_u32_unchecked(s: &str) -> Result<u32, ParseIntError> {
+ u32::from_str_radix(s, 16).map_err(|error| ParseIntError {
+ input: s.into(),
+ bits: 32,
+ is_signed: false,
+ source: error,
+ })
+}
+
+/// Parses a `u128` from a hex string.
+///
+/// Input string may or may not contain a `0x` (or `0X`) prefix.
+///
+/// # Errors
+///
+/// If the input string is not a valid hex encoding of a `u128`.
+pub fn hex_u128(s: &str) -> Result<u128, ParseIntError> {
+ let unchecked = hex_remove_optional_prefix(s);
+ hex_u128_unchecked(unchecked)
+}
+
+/// Parses a `u128` from a prefixed hex string.
+///
+/// # Errors
+///
+/// - If the input string does not contain a `0x` (or `0X`) prefix.
+/// - If the input string is not a valid hex encoding of a `u128`.
+pub fn hex_u128_prefixed(s: &str) -> Result<u128, PrefixedHexError> {
+ let checked = hex_remove_prefix(s)?;
+ Ok(hex_u128_unchecked(checked)?)
+}
+
+/// Parses a `u128` from an unprefixed hex string.
+///
+/// # Errors
+///
+/// - If the input string contains a `0x` (or `0X`) prefix.
+/// - If the input string is not a valid hex encoding of a `u128`.
+pub fn hex_u128_unprefixed(s: &str) -> Result<u128, UnprefixedHexError> {
+ let checked = hex_check_unprefixed(s)?;
+ Ok(hex_u128_unchecked(checked)?)
+}
+
+/// Parses a `u128` from an unprefixed hex string without first checking for a prefix.
+///
+/// # Errors
+///
+/// - If the input string contains a `0x` (or `0X`) prefix, returns `InvalidDigit` due to the `x`.
+/// - If the input string is not a valid hex encoding of a `u128`.
+pub fn hex_u128_unchecked(s: &str) -> Result<u128, ParseIntError> {
+ u128::from_str_radix(s, 16).map_err(|error| ParseIntError {
+ input: s.into(),
+ bits: 128,
+ is_signed: false,
+ source: error,
+ })
+}
+
+/// Strips the hex prefix off `s` if one is present.
+pub(crate) fn hex_remove_optional_prefix(s: &str) -> &str {
+ if let Some(stripped) = s.strip_prefix("0x") {
+ stripped
+ } else if let Some(stripped) = s.strip_prefix("0X") {
+ stripped
+ } else {
+ s
+ }
+}
+
+/// Error returned when parsing an integer from a hex string that is supposed to contain a prefix.
+#[derive(Debug, Clone, Eq, PartialEq)]
+pub struct PrefixedHexError(PrefixedHexErrorInner);
+
+/// Error returned when parsing an integer from a hex string that is supposed to contain a prefix.
+#[derive(Debug, Clone, Eq, PartialEq)]
+enum PrefixedHexErrorInner {
+ /// Hex string is missing prefix.
+ MissingPrefix(MissingPrefixError),
+ /// Error parsing integer from hex string.
+ ParseInt(ParseIntError),
+}
+
+impl From<Infallible> for PrefixedHexError {
+ fn from(never: Infallible) -> Self { match never {} }
+}
+
+impl From<Infallible> for PrefixedHexErrorInner {
+ fn from(never: Infallible) -> Self { match never {} }
+}
+
+impl fmt::Display for PrefixedHexError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ use PrefixedHexErrorInner as E;
+
+ match self.0 {
+ E::MissingPrefix(ref e) => write_err!(f, "hex string is missing prefix"; e),
+ E::ParseInt(ref e) => write_err!(f, "prefixed hex string invalid int"; e),
+ }
+ }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for PrefixedHexError {
+ fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
+ use PrefixedHexErrorInner as E;
+
+ match self.0 {
+ E::MissingPrefix(ref e) => Some(e),
+ E::ParseInt(ref e) => Some(e),
+ }
+ }
+}
+
+impl From<MissingPrefixError> for PrefixedHexError {
+ fn from(e: MissingPrefixError) -> Self { Self(PrefixedHexErrorInner::MissingPrefix(e)) }
+}
+
+impl From<ParseIntError> for PrefixedHexError {
+ fn from(e: ParseIntError) -> Self { Self(PrefixedHexErrorInner::ParseInt(e)) }
+}
+
+/// Error returned when parsing an integer from a hex string that is not supposed to contain a prefix.
+#[derive(Debug, Clone, Eq, PartialEq)]
+pub struct UnprefixedHexError(UnprefixedHexErrorInner);
+
+#[derive(Debug, Clone, Eq, PartialEq)]
+enum UnprefixedHexErrorInner {
+ /// Hex string contains prefix.
+ ContainsPrefix(ContainsPrefixError),
+ /// Error parsing integer from string.
+ ParseInt(ParseIntError),
+}
+
+impl From<Infallible> for UnprefixedHexError {
+ fn from(never: Infallible) -> Self { match never {} }
+}
+
+impl From<Infallible> for UnprefixedHexErrorInner {
+ fn from(never: Infallible) -> Self { match never {} }
+}
+
+impl fmt::Display for UnprefixedHexError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ use UnprefixedHexErrorInner as E;
+
+ match self.0 {
+ E::ContainsPrefix(ref e) => write_err!(f, "hex string is contains prefix"; e),
+ E::ParseInt(ref e) => write_err!(f, "hex string parse int"; e),
+ }
+ }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for UnprefixedHexError {
+ fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
+ use UnprefixedHexErrorInner as E;
+
+ match self.0 {
+ E::ContainsPrefix(ref e) => Some(e),
+ E::ParseInt(ref e) => Some(e),
+ }
+ }
+}
+
+impl From<ContainsPrefixError> for UnprefixedHexError {
+ fn from(e: ContainsPrefixError) -> Self { Self(UnprefixedHexErrorInner::ContainsPrefix(e)) }
+}
+
+impl From<ParseIntError> for UnprefixedHexError {
+ fn from(e: ParseIntError) -> Self { Self(UnprefixedHexErrorInner::ParseInt(e)) }
+}
+
+/// Error returned when a hex string is missing a prefix (e.g. `0x`).
+#[derive(Debug, Clone, Eq, PartialEq)]
+struct MissingPrefixError {
+ hex: InputString,
+}
+
+impl MissingPrefixError {
+ /// Constructs a new error from the string with the missing prefix.
+ pub(crate) fn new(hex: &str) -> Self { Self { hex: hex.into() } }
+}
+
+impl fmt::Display for MissingPrefixError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{} because it is missing the '0x' prefix", self.hex.display_cannot_parse("hex"))
+ }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for MissingPrefixError {}
+
+/// Error when hex string contains a prefix (e.g. 0x).
+#[derive(Debug, Clone, Eq, PartialEq)]
+struct ContainsPrefixError {
+ hex: InputString,
+}
+
+impl ContainsPrefixError {
+ /// Constructs a new error from the string that contains the prefix.
+ pub(crate) fn new(hex: &str) -> Self { Self { hex: hex.into() } }
+}
+
+impl fmt::Display for ContainsPrefixError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{} because it contains the '0x' prefix", self.hex.display_cannot_parse("hex"))
+ }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for ContainsPrefixError {}
+
+#[cfg(test)]
+mod tests {
+ #[cfg(feature = "std")]
+ use std::panic;
+
+ use super::*;
+
+ #[test]
+ fn parse_int() {
+ assert!(int_from_str::<u8>("1").is_ok());
+ let _ = int_from_str::<i8>("not a number").map_err(|e| assert!(e.is_signed));
+ let _ = int_from_str::<u8>("not a number").map_err(|e| assert!(!e.is_signed));
+ }
+
+ #[test]
+ #[cfg(feature = "std")]
+ fn parse_int_panic_when_populating_bits() {
+ // Fields in the test type are never used
+ #[allow(dead_code)]
+ struct TestTypeLargerThanU128(u128, u128);
+ impl_integer!(TestTypeLargerThanU128);
+ impl FromStr for TestTypeLargerThanU128 {
+ type Err = core::num::ParseIntError;
+
+ fn from_str(_: &str) -> Result<Self, Self::Err> {
+ "Always invalid for testing".parse::<u32>().map(|_| TestTypeLargerThanU128(0, 0))
+ }
+ }
+ impl From<i8> for TestTypeLargerThanU128 {
+ fn from(_: i8) -> Self { TestTypeLargerThanU128(0, 0) }
+ }
+
+ let result = panic::catch_unwind(|| int_from_str::<TestTypeLargerThanU128>("not a number"));
+ assert!(result.is_err());
+ }
+
+ #[test]
+ fn remove_prefix() {
+ let lower = "0xhello";
+ assert_eq!(hex_remove_prefix(lower).unwrap(), "hello");
+
+ let upper = "0Xhello";
+ assert_eq!(hex_remove_prefix(upper).unwrap(), "hello");
+
+ let err = "error";
+ assert!(hex_remove_prefix(err).is_err());
+ }
+
+ #[test]
+ fn check_unprefixed() {
+ let lower = "0xhello";
+ assert!(hex_check_unprefixed(lower).is_err());
+
+ let upper = "0Xhello";
+ assert!(hex_check_unprefixed(upper).is_err());
+
+ let valid = "hello";
+ assert_eq!(hex_check_unprefixed(valid).unwrap(), "hello");
+ }
+
+ #[test]
+ fn parse_u32_from_hex_prefixed() {
+ let want = 171;
+ let got = hex_u32("0xab").expect("failed to parse prefixed hex");
+ assert_eq!(got, want);
+ }
+
+ #[test]
+ fn parse_u32_from_hex_no_prefix() {
+ let want = 171;
+ let got = hex_u32("ab").expect("failed to parse non-prefixed hex");
+ assert_eq!(got, want);
+ }
+
+ #[test]
+ fn parse_hex_u32_prefixed() {
+ let want = 171; // 0xab
+ assert_eq!(hex_u32_prefixed("0xab").unwrap(), want);
+ assert!(hex_u32_unprefixed("0xab").is_err());
+ }
+
+ #[test]
+ fn parse_hex_u32_unprefixed() {
+ let want = 171; // 0xab
+ assert_eq!(hex_u32_unprefixed("ab").unwrap(), want);
+ assert!(hex_u32_prefixed("ab").is_err());
+ }
+
+ #[test]
+ fn parse_u128_from_hex_prefixed() {
+ let want = 3_735_928_559;
+ let got = hex_u128("0xdeadbeef").expect("failed to parse prefixed hex");
+ assert_eq!(got, want);
+ }
+
+ #[test]
+ fn parse_u128_from_hex_no_prefix() {
+ let want = 3_735_928_559;
+ let got = hex_u128("deadbeef").expect("failed to parse non-prefixed hex");
+ assert_eq!(got, want);
+ }
+
+ #[test]
+ fn parse_hex_u128_prefixed() {
+ let want = 3_735_928_559;
+ assert_eq!(hex_u128_prefixed("0xdeadbeef").unwrap(), want);
+ assert!(hex_u128_unprefixed("0xdeadbeef").is_err());
+ }
+
+ #[test]
+ fn parse_hex_u128_unprefixed() {
+ let want = 3_735_928_559;
+ assert_eq!(hex_u128_unprefixed("deadbeef").unwrap(), want);
+ assert!(hex_u128_prefixed("deadbeef").is_err());
+ }
+
+ #[test]
+ fn parse_u32_from_hex_unchecked_errors_on_prefix() {
+ assert!(hex_u32_unchecked("0xab").is_err());
+ }
+}
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index 5aba6829..a74eea04 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
use crate::locktime::relative::error::TimeOverflowError;
use crate::locktime::relative::{self, NumberOf512Seconds};
-use crate::parse::{self, PrefixedHexError, UnprefixedHexError};
+use crate::parse_int::{self, PrefixedHexError, UnprefixedHexError};
/// Bitcoin transaction input sequence number.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -129,7 +129,7 @@ impl Sequence {
/// the `0x` prefix.
#[inline]
pub fn from_hex(s: &str) -> Result<Self, PrefixedHexError> {
- let lock_time = parse::hex_u32_prefixed(s)?;
+ let lock_time = parse_int::hex_u32_prefixed(s)?;
Ok(Self::from_consensus(lock_time))
}
@@ -141,7 +141,7 @@ impl Sequence {
/// `0x` prefix.
#[inline]
pub fn from_unprefixed_hex(s: &str) -> Result<Self, UnprefixedHexError> {
- let lock_time = parse::hex_u32_unprefixed(s)?;
+ let lock_time = parse_int::hex_u32_unprefixed(s)?;
Ok(Self::from_consensus(lock_time))
}
@@ -262,7 +262,7 @@ impl fmt::Debug for Sequence {
}
#[cfg(feature = "alloc")]
-parse::impl_parse_str_from_int_infallible!(Sequence, u32, from_consensus);
+parse_int::impl_parse_str_from_int_infallible!(Sequence, u32, from_consensus);
#[cfg(feature = "arbitrary")]
#[cfg(feature = "alloc")]
diff --git a/units/src/weight.rs b/units/src/weight.rs
index 3fa4852f..98726a7f 100644
--- a/units/src/weight.rs
+++ b/units/src/weight.rs
@@ -10,7 +10,7 @@ use arbitrary::{Arbitrary, Unstructured};
#[cfg(feature = "serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};
-use crate::{parse, Amount, FeeRate, NumOpResult};
+use crate::{parse_int, Amount, FeeRate, NumOpResult};
/// The factor that non-witness serialization data is multiplied by during weight calculation.
pub const WITNESS_SCALE_FACTOR: usize = 4;
@@ -271,7 +271,7 @@ impl<'a> core::iter::Sum<&'a Weight> for Weight {
}
}
-parse::impl_parse_str_from_int_infallible!(Weight, u64, from_wu);
+parse_int::impl_parse_str_from_int_infallible!(Weight, u64, from_wu);
#[cfg(feature = "serde")]
impl Serialize for Weight {
diff --git a/units/tests/api.rs b/units/tests/api.rs
index 72e078a4..32274c00 100644
--- a/units/tests/api.rs
+++ b/units/tests/api.rs
@@ -14,7 +14,7 @@ use arbitrary::{Arbitrary, Unstructured};
// These imports test "typical" usage by user code.
use bitcoin_units::locktime::{absolute, relative}; // Typical usage is `absolute::LockTime`.
use bitcoin_units::{
- amount, block, fee_rate, locktime, parse, result, time, weight, Amount, BlockHeight,
+ amount, block, fee_rate, locktime, parse_int, result, time, weight, Amount, BlockHeight,
BlockHeightInterval, BlockMtp, BlockMtpInterval, BlockTime, FeeRate, NumOpResult, SignedAmount,
Weight,
};
@@ -145,14 +145,14 @@ struct Errors {
q: locktime::relative::InvalidHeightError,
r: locktime::relative::InvalidTimeError,
s: locktime::relative::TimeOverflowError,
- t: parse::ParseIntError,
- u: parse::PrefixedHexError,
- v: parse::UnprefixedHexError,
+ t: parse_int::ParseIntError,
+ u: parse_int::PrefixedHexError,
+ v: parse_int::UnprefixedHexError,
}
#[test]
fn api_can_use_modules_from_crate_root() {
- use bitcoin_units::{amount, block, fee_rate, locktime, parse, time, weight};
+ use bitcoin_units::{amount, block, fee_rate, locktime, parse_int, time, weight};
}
#[test]
@@ -217,7 +217,7 @@ fn api_can_use_all_types_from_module_locktime_relative() {
#[test]
fn api_can_use_all_types_from_module_parse() {
- use bitcoin_units::parse::{ParseIntError, PrefixedHexError, UnprefixedHexError};
+ use bitcoin_units::parse_int::{ParseIntError, PrefixedHexError, UnprefixedHexError};
}
#[test]
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.