rust-bitcoin-unsafe-fast/units/src/amount
Tobin C. Harding ab4ea7c13d
Enforce the MAX_MONEY invariant in amount types
Enforcing the MAX_MONEY invariant is quite involved because it means
multiple things:

- Constructing amounts is now fallible
- Converting from unsigned to signed is now infallible
- Taking the absolute value is now infallible
- Integer overflow is illuminated in various places

Details:

- Update from_sat to check the invariant
- Fix all docs including examples
- Use the unchecked constructor in test code
- Comment any other use of the unchecked constructor
- Deprecate unchecked_abs
- Fail serde (using the horrible string error variant)
- Try not to use the unchecked constructor in rustdocs, no need to encourage unsuspecting users to use it.
- Use ? in rustdoc examples (required by Rust API guidlines)
- Remove TryFrom<Amount> for SignedAmount because the conversion is now infallible. Add a From impl.
- Fix the arbitrary impls
- Maintain correct formatting
- Remove private check_max function as its no longer needed
2025-03-13 09:07:14 +11:00
..
error.rs Remove usage of impl_from_infallible in leaf crates 2025-01-02 07:51:21 +11:00
mod.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
result.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
serde.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
signed.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
tests.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
unsigned.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00
verification.rs Enforce the MAX_MONEY invariant in amount types 2025-03-13 09:07:14 +11:00