debug_stub_derive icon indicating copy to clipboard operation
debug_stub_derive copied to clipboard

#[ignore] attribute for generics

Open kangalio opened this issue 3 years ago • 1 comments

Rust's built in Debug derive adds : Debug bounds for all generics. This can be unnecessarily restrictive, so it would be great to be able to omit those bounds.

Potential designs:

1. Attribute on the generics themselves

#[derive(DebugStub)]
struct MyStruct<#[debug(ignore)] U, #[debug(ignore)] E> {}

2. Attribute on the entire struct

#[derive(DebugStub)]
#[debug(ignore_generics)]
struct MyStruct<U, E> {}

3. Both

Support both. Struct-level attribute overrides generics-level attributes


I'd be up to implement this myself (debug_stub_derive could really help me out, example), although this repo seems to be abandoned... should I just fork?

kangalio avatar Jan 05 '22 18:01 kangalio

Only approach 2 is viable because derive macros apparently don't support attributes on generics

kangalio avatar Jan 08 '22 17:01 kangalio