The `FeeRate` type wraps a `u64` but the inner value implicitly contains information about the unit. As such when serializing and deserializing the unit information is not explicit and if users try to deserialize with a different unit their code will be silently buggy. As we do for Amount; add custom serde modules so that users can serialize in an explicit unit. Furthermore remove the derived impls forcing users to make the decision. This is as we do for `Amount`. With this applied one can write ```rust #[derive(Serialize, Deserialize)] pub struct Foo { #[serde(with = "bitcoin_units::fee_rate::serde::as_sat_per_kwu")] pub fee_rate: FeeRate, } ``` |
||
---|---|---|
.. | ||
contrib | ||
src | ||
tests | ||
CHANGELOG.md | ||
Cargo.toml | ||
README.md |
README.md
Bitcoin Units
This crate provides basic Bitcoin numeric units such as Amount
.
Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on Rust 1.63.0.
Licensing
The code in this project is licensed under the Creative Commons CC0 1.0 Universal license. We use the SPDX license list and SPDX IDs.