derive_more
                                
                                
                                
                                    derive_more copied to clipboard
                            
                            
                            
                        Some more derive(Trait) options
Fixes https://github.com/JelteF/derive_more/issues/142 by implementing the solution proposed in the OP. Once the proposal is validated, I'll fill in this PR with more details and polish it up for review. ---...
An idea for improving explicitness (I may submit a PR in the future) At the moment: ```rust #[derive(From)] enum Conflicting { A(u8), B(u8), C(u16) } #[test] fn conflicting_enum() { let...
While there's no true `IntoInner` trait, it's a super common pattern for newtypes to provide an `into_inner` function. It'd be great if this crate could make it easy to add...
If you `#[derive(Mul)]` (or `MulAssign`) on a struct, it will implement the multiplication with a primitive type, but not with a struct of the same type. If you add `#[mul(forward)]`...
This PR makes the generated code compatible with a global setting of `#![deny(clippy::use_self)]` by using `Self::Variant` instead of `EnumName::Variant`.
This would allow the same flexibility that's provided by [`derive_new`](https://github.com/nrc/derive-new) for `From`, `TryFrom`, `FromStr` and `Constructor`. It would also be nice to add `new` as a derive as well, so...
When using the derived `TryInto/TryFrom` instances, if the result is an `Error`, the original value is consumed (if it is not a reference). This prevents the valid use case of...
```rust #[derive(Add, AddAssign, Sub, SubAssign)] struct Example(usize); ``` should generate ```rust impl Sub for Example where usize: Sub, { type Output = Self; #[must_use] #[inline] fn sub(self, rhs: T) ->...
https://crates.io/crates/watt
Here's a simple repro: ```rust #[derive(Debug)] struct Foo {} #[derive(Debug)] struct Bar {} #[derive(Debug, derive_more::From, derive_more::Display)] pub enum ErrEnum { #[display("Blah")]] Unknown, #[display("Box1: {0:?}")] #[from(forward)] Box1(Box), #[display("Box2: {0:?}")] #[from(forward)] Box2(Box),...