derive_more
derive_more copied to clipboard
Some more derive(Trait) options
We can use `rustversion` for this. For some of the tests its still needed because of this error: ``` error[E0658]: non-inline modules in proc macro input are unstable --> tests/error/mod.rs:53:1...
Is there a technical reason not to support `Deref` and `DerefMut` for enum input types? Seems to me like this would work pretty idiomatically so long as the different variants...
While using the Rust beta release, I got a some warning around derived `Display` impls. The exact warning message is below: ``` warning: non-local `impl` definition, they should be avoided...
It'd be really handy to be able to reuse some of the `derive_more` macros, for example I'd like to be able to reuse the display-like formatting in my own macros...
So far, it seems derive_more cannot derive `PartialEq`. I'd like to migrate from the unmaintained [derivative](https://crates.io/crates/derivative) to this crate but found this missing feature that prevent so. Is there any...
As an example: ```rust /// does not compile because Deref(Mut) targets must be the same type. #[derive(Deref, DerefMut)] pub struct Foo { #[deref] inner: String, #[deref_mut] another: i32, // would...
Currently code like this: ```rust #[derive(Debug)] pub enum Test { #[debug(skip)] Foo } ``` Does not compile. Usually it will print something like `Test::Foo`, now I just want it to...
Resolves #358 ## Synopsis A new derive for generating `as_foo`, `as_bar` methods for an enum with fields `foo` and `bar`. ## Solution Similar to TryUnwrap but generates functions returning an...
```rust #[derive(Into)] pub struct A( [u8; Self::SIZE]); impl A { const SIZE: usize = 32; } ``` This generates following code: ```rust #[allow(clippy::unused_unit)] #[automatically_derived] impl derive_more::core::convert::From for ( [u8; Self::SIZE]...
This should work: ```rust #[derive(Display)] #[display("{_0}")] enum Enum { #[display("A")] A(i32), #[display("B")] B(&'static str), #[display("C")] C(T), } fn main() { assert_eq!(Enum::::A(1).to_string(), "A"); assert_eq!(Enum::::B("abc").to_string(), "B"); assert_eq!(Enum::::C(9).to_string(), "C"); } ``` As well...