-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add impl_fmt_traits
macro
#90
Conversation
PR is tested in rust-bitcoin/rust-bitcoin#2770 |
52d907b
to
a06b7ed
Compare
In a06b7ed: Concept ACK. But
impl_fmt_traits! {
#[reverse(true)] // or whatever
impl<T: Whatever> all_fmt_traits for MyType<T> {
const LENGTH: usize = 32;
}
} |
|
4ba1693
to
7ddf1c0
Compare
Add a macro that implements the `fmt::{LowerHex, UpperHex, Display, Debug}` traits. Includes support for displaying backwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK cb9b86a I am a tiny bit tempted to say that the const LENGTH
should wind up as an actual associated constant. Though this is easy to add in a followup PR
@apoelstra that's impossible because you can't write |
Add a macro that implements the
fmt::{LowerHex, UpperHex, Display, Debug}
traits. Includes support for displaying backwards.Context
In
bitcoin_hashes
we have two versions of this code, moving it here is better because it is general hex related code. Note however that the reason for supporting display backwards might see strange unusual to the casual reader.Note
Note please the use of naked
core::foo
in the macro requiringcore
to be in scope, is this reasonable of should we do the ugly re-export stuff we do inbitcoin_hashes
:$crate::_export::_core::foo
?