derive_more icon indicating copy to clipboard operation
derive_more copied to clipboard

Some more derive(Trait) options

Results 113 derive_more issues
Sort by recently updated
recently updated
newest added
trafficstars

i'd like to propose a derive for static string "as_str" methods for enums. for example: ```rs trait AsStr { fn as_str(&self) -> &'static str; } #[derive(AsStr)] enum Foo { A,...

Part of #163 Follows #473 ## Synopsis `derive(PartialEq)` in `std` generates only `PartialEq::eq()` method implementation in its expansion. This silently kills any potential performance benefits if the underlying types implement...

enhancement

Follows #468 ## Synopsis In #468, the `FromStr` derive was reworked. However, the check for inferring trait bounds for the inner type was simplified to `!generics.params.is_empty()`, which is not a...

enhancement

Resolves #437 ## Synopsis As outlined in #437 it isn't possible to derive `Add` for structs containing zero sized fields Example: ```rust #[derive(Add)] // method not found in `PhantomData` struct...

enhancement

It would be great to have a simple derive for Boxed newtypes to just use `.into` with: ```rust #[derive(IntoBox)] struct BoxedError(Box); ``` The specific use case is that with `thiserror`...

> Deriving `Into` for enums is not supported as it would not always be successful, so `TryInto` should be used instead. This is true for enums with payloads, but for...

enhancement
new derive

Resolves #361 ## Synopsis It currently isn't possible to use `#[derive(Mul)]` to implement multiplication with itself AND with a scalar at the same time. Example: ```rust fn without_forward() { #[derive(Clone,...

The built-in `#[derive(Copy, Clone)]` and others in Rust have this rule that all generic type parameters must also implement `Copy` or `Clone`. Perhaps the logic relies on this to ensure...

enhancement

Would it be possible to allow users to specify the error type returned from `TryFrom` implementations? Something like ```rust #[derive(From)] struct UnknownMode(u8); #[derive(TryFrom)] #[try_from(repr, error = UnknownMode)] #[repr(u8)] enum Mode...

Ignore zero-width fields to allow complier hinting with types like `PhantomData` while deriving trait imlementations. ```rs // This should work. #[derive(derive_more::Add)] struct A(u16, PhantomData); // Equivalent to: impl Add for...

enhancement