Open FalkWoldmann opened 5 months ago
Looking at how derive_more
works I think this addition makes most sense within that crate. I am not sure if you'd be willing to make an issue or PR for them but that would allow for a more generic fix. In particular, the ask wouldn't be for them to support faux
but for them to support adding an arbitrary attribute on top of their impl
.
I envision something like:
#[cfg_attr(test, faux::create)]
#[derive(Constructor)]
// when in test, make the `impl` block generated by `derive_more::Constructor` forward a custom attribute
#[cfg_attr(test, constructor(forward = "faux::methods"))]
struct Foo {
bar: Bar,
}
That way neither derive_more
nor faux
have to directly know about each other while still co-existing.
Hi, using both
derive_more::Constructor
andfaux
on the same struct like in following example will lead to an error when trying to compile the tests.Writing the
new()
function by hand works fine:Do you think it would be possible to add support for
#[derive(Constructor)]
?