syncbox icon indicating copy to clipboard operation
syncbox copied to clipboard

Implement debug for atomics

Open obourgain opened this issue 9 years ago • 2 comments

Deriving debug would be nice to allow users to also derive debug in their own structs. Otherwise the compiler fails with something like

src/lib.rs:54:5: 54:25 error: the trait `core::fmt::Debug` is not implemented for the type `syncbox::atomic::types::AtomicU64` [E0277]
src/lib.rs:54     max_value: AtomicU64
                  ^~~~~~~~~~~~~~~~~~~~
src/lib.rs:41:10: 41:15 note: in this expansion of #[derive_Debug] (defined in src/lib.rs)
src/lib.rs:54:5: 54:25 help: run `rustc --explain E0277` to see a detailed explanation
src/lib.rs:54:5: 54:25 note: `syncbox::atomic::types::AtomicU64` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
src/lib.rs:54:5: 54:25 note: required for the cast to the object type `core::fmt::Debug`

obourgain avatar Mar 29 '16 15:03 obourgain

I would also like to have #[derive(Default)]

obourgain avatar Mar 29 '16 15:03 obourgain

My current workaround is to define a simple wrapper struct around AtomicU64 and implement Debug and Default myself

obourgain avatar Mar 29 '16 15:03 obourgain