In an effort to reduce requirement for `alloc`; remove the `String` and use `InputString` in the hex prefix related error types. Tested with: (Note in test code we have to use `"cafe".to_owned()` before this patch is applied.) rust``` #[test] fn hex_prefix_errors() { let err = hex_remove_prefix("cafe").unwrap_err(); std::println!("{}", err); std::println!("{:?}", err); let err = hex_check_unprefixed("0xcafe").unwrap_err(); std::println!("{}", err); std::println!("{:?}", err); } ``` Before: hex string is missing a prefix (e.g. 0x): cafe MissingPrefixError { hex: "cafe" } hex string contains a prefix: 0xcafe ContainsPrefixError { hex: "0xcafe" } After: failed to parse 'cafe' as hex because it is missing the '0x' prefix MissingPrefixError { hex: InputString("cafe") } failed to parse '0xcafe' as hex because it contains the '0x' prefix ContainsPrefixError { hex: InputString("0xcafe") } |
||
---|---|---|
.. | ||
contrib | ||
src | ||
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.