NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #263 most downloaded on crates.io
Adds #[derive(x)] macros for more traits
Last release 9 months ago
22 Dec 2025
Release timing varies
gaps range from 2 weeks to 1.6 years
Most releases are documented
notes for 30 of 44 stable releases
2 versions withdrawn
withdrawn after publishing
11 years old
51 releases · first in 2016
API docs Changelog
.as_dyn_error() method hygiene inside Error derive expansion.
(#527)Suppress deprecation warnings in generated code.
#[display(rename_all = "<casing>")] attribute to change output for implicit naming of unit enum variants or unit structs when deriving Display. (#443)#[from_str(rename_all = "<casing>")] attribute for unit enum variants and unit structs when deriving FromStr. (#467)Option fields for Error::source() in Error derive. (#459)FromStr derive. (#469)PartialEq derive similar to std's one, but considering generics correctly, and implementing ne() method as well. (#473, #475)Eq derive similar to std's one, but considering generics correctly. (#479)#[allow]/#[expect] attributes of the type in Constructor derive. (#477)Deref and DerefMut derives for enums. (#485)FromStr derive. (#494)TryInto derive. (#503)Add-like, AddAssign-like, Mul-like and MulAssign-like derives. (#472)Add-like, AddAssign-like, Mul-like and MulAssign-like derives now infer trait bounds for generics structurally (bound field types instead of type parameters directly). (#472)#[try_from(repr)] attribute is not specified for TryFrom derive. (#458)AsRef/AsMut derives when associative types are involved. (#474)Try/TryInto derives when Self type is present in the struct or enum definition. (#489)feature(error_generic_member_access) in Error derive when using Backtrace on a non-nightly toolchain. (#513)#[<display-trait>("default formatting")] attribute without {_variant} being used as default for enum variants without explicit formatting. (#495)Full Changelog: v2.0.1...v2.1.0
One column per quarter.
API docs Changelog
use derive_more::SomeTrait now imports macro only. Importing macro with its trait along is possible now via use derive_more::with_trait::SomeTrait .
use derive_more::SomeTrait now imports macro only. Importing macro with its trait along is possible now via use derive_more::with_trait::SomeTrait. (#406)#[display("...")] attribute on an enum now has defaulting behavior instead of replacing when no wrapping is possible (no _variant placeholder). (#395)Debug and Display expansions. (#399)unreachable_code warnings on generated code when ! (never type) is used. (#404)TryFrom, TryInto or FromStr with an associated item called Error or Err respectively. (#410)#[display("...")] attribute on an enum being incorrectly treatedDebug and Display expansions. (#431)Debug expansions. (#431)#[display("...")] attribute on an enum not working transparently for directly specified fields. (#438)Debug and Display expansions. (#440)Full Changelog: v1.0.0...v2.0.0
derive_more is a library that adds derives for many of the standard library traits. By using this library the following code just works:
derive_more is a library that adds derives for many of the standard library traits. By using this library the following code just works:
use derive_more::{Add, Display, From, Into};
#[derive(PartialEq, From, Add)]
struct MyInt(i32);
#[derive(PartialEq, From, Into)]
struct Point2D {
x: i32,
y: i32,
}
#[derive(PartialEq, From, Add, Display)]
enum MyEnum {
#[display("int: {_0}")]
Int(i32),
Uint(u32),
#[display("nothing")]
Nothing,
}
assert!(MyInt(11) == MyInt(5) + 6.into());
assert!((5, 6) == Point2D { x: 5, y: 6 }.into());
assert!(MyEnum::Int(15) == (MyEnum::Int(8) + 7.into()).unwrap());
assert!(MyEnum::Int(15).to_string() == "int: 15");
assert!(MyEnum::Uint(42).to_string() == "42");
assert!(MyEnum::Nothing.to_string() == "nothing");Now, more than 8 years after the first commit and almost 5 years after the 0.99.0 release, derive_more has finally reached its 1.0.0 release. This release contains a lot of changes (including some breaking ones) to make it easier to use the derives and make it possible to extend them without having to break backwards compatibility again. There are five major changes that I would like to call out, but there are many more changes that are documented below:
Debug derive that can be used to easily customize Debug formatting.Display derive, which allows you to do anything that thiserror provides, but it works for any type not just errors. And by combining the Display derive with the Error and From derives, there shouldn't really be any need to use thiserror anymore (if you are missing a feature/behaviour from thiserror please report an issue).Error when an error occurs instead of a &'static str.use derive_more::SomeTrait the actual trait is also imported not just the derive macro. This is especially useful for Error andDisplaystd feature which should be disabled in no_std environments.std, are now disabled by default. The full feature can be used to get the old behavior of supporting all possible derives.TryFrom, Add, Sub, BitAnd, BitOr, BitXor, Not and Neg derives now return a dedicated error type instead of a &'static str on error.FromStr derive now uses a dedicated FromStrError error type instead of generating unique one each time.Display derive (and other fmt-like ones) now uses #[display("...", (<expr>),*)] syntax instead of #[display(fmt = "...", ("<expr>"),*)], and #[display(bound(<bound>))] instead of #[display(bound = "<bound>")]. So without the double quotes around the expressions and bounds.Debug and Display derives (and other fmt-like ones) now transparently delegate to the inner type when #[display("...", (<expr>),*)] attribute is trivially substitutable with a transparent call. (#322)DebugCustom derive is renamed to just Debug (gated now under a separate debug feature), and its semantics were changed to be a superset of std variant of Debug.From derive doesn't derive From<()> for enum variants without any fields anymore. This feature was removed because it was considered useless in practice.From derive now uses #[from(<types>)] instead of #[from(types(<types>))] and ignores field type itself.Into derive now uses #[into(<types>)] instead of #[into(types(<types>))] and ignores field type itself.Into derive now generates separate impls for each field whenever the #[into(...)] attribute is applied to it. (#291)Error derive is updated with changes to the error_generic_member_access unstable feature for nightly users. (#200, #294)as_mut feature is removed, and the AsMut derive is now gated by the as_ref feature. (#295)#[display("...")] attribute on an enum now requires the usage of {_variant} to include the variant instead of including it at {}. The reason is that {} now references the first argument to the format string, just like in all other format strings. (#377)Display derives. So now you can use: #[display(fmt = "Prefix: {field}")] instead of needing to use #[display(fmt = "Prefix: {}", field)]FromStr derive support for enums that contain variants without fields. If you pass the name of the variant to from_str it will create the matching variant.#[unwrap(owned, ref, ref_mut)] attribute for the Unwrap derive. By using them, it is possible to derive implementations for the reference types as well. (#206)TryUnwrap derive similar to the Unwrap derive. This one returns a Result and does not panic. (#206)Debug derive with the same syntax as Display derives. (#279)derive_more::derive module exporting only macros, without traits. (#290)AsRef/AsMut derives. (#298)TryFrom derive for enums to convert from their discriminant. (#300)#[inline] attributes to IsVariant and Debug implementations. (#334#[track_caller] to Add, Mul, AddAssign and MulAssign derives (#378Constructor and IsVariant derives now generate const fn functions.IsVariant are now marked #[must_use]. (#350)Unwrap and IsVariant derives now generate doc comments.#[automatically_derived] is now emitted from all macro expansions. This should prevent code style linters from attempting to modify the generated code.syn 2.0.Error derive now works in nightly no_std environmentsHashSet in all derives, this is needed for rust analyzer to work correctly.Provider API for backtraces in Error derive.Error derive not working with const generics.Box<dyn Error + Send + 'static>IntoIterator impls for generic structs. (#284)Display derive. (#297)core crate. (#327)IsVariant derive.{field:p} do the expected thing in format strings for Display and Debug. Also document weirdness around Pointer formatting when using expressions, due to field variables being references. (#381)Full Changelog: v0.99.18...v1.0.0
API docs Changelog
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
chore: Release derive_more version 0.99.20
chore: Release derive_more version 0.99.20
chore: Release derive_more version 0.99.19
chore: Release derive_more version 0.99.19
chore: Release derive_more version 0.99.18
chore: Release derive_more version 0.99.18
syn 2.0.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
From supports additional types for conversion: #[from(types(u8, u16))].
From supports additional types for conversion: #[from(types(u8, u16))].Nothing published for this version
Nothing published for this version
When specifying specific features of the crate to only enable specific derives, the extra-traits feature of syn is not always enabled when those the s
extra-traits feature of syn is not always enabled
when those the specified features do not require it. This should speed up
compile time of syn when this feature is not needed.MulAssignMake sure output of derives is deterministic, for better support in rust-analyzer
Support for deriving Error!!! (many thanks to @ffuugoo and @tyranron)
Error!!! (many thanks to @ffuugoo and @tyranron)Fix generic bounds for Deref and DerefMut with forward, i.e. put Deref
bound on whole type, so on where Box<T>: Deref instead of on T: Deref.
(#107)
The tests directory is now correctly included in the crate (requested by
Debian package maintainers)
Note: This version is yanked, because quickly after release it was found out tests did not run in CI.
Note: This version is yanked, because quickly after release it was found out tests did not run in CI.
Fix generic bounds for Deref and DerefMut with no forward, i.e. no bounds are necessary.
Deref and DerefMut with no forward, i.e. no bounds
are necessary. (#107)Hotfix for a regression in allowed Display derives using # flag, such as {:#b}
Display derives using # flag, such as
{:#b} (#107)Hotfix for a regression in allowed From derives
From derives
(#105)This is why the next release with breaking changes is planned to be 1.0.0.
This release is a huge milestone for this library. Lot's of new derives are implemented and a ton of attributes are added for configuration purposes. These attributes will allow future releases to add features/options without breaking backwards compatibility. This is why the next release with breaking changes is planned to be 1.0.0.
extern crate core to your
code.no_std feature is removed, the library now supports no_std without having
to configure any features.Deref derives now dereference to the type in the newtype. So if you have
MyBox(Box<i32>), dereferencing it will result in a Box<i32> not an i32.
To get the old behaviour of forwarding the dereference you can add the
#[deref(forward)] attribute on the struct or field.AsRef, AsMut, Sum, Product, IntoIterator.From, by using #[from(ignore)].#[from(forward)] attribute for From derives. This forwards the from
calls to the fields themselves. So if your field is an i64 you can call from
on an i32 and it will work.#[mul(forward)] and #[mul_assign(forward)], which implement Mul and
MulAssign with the semantics as if they were Add/AddAssign.#[into(owned, ref, ref_mut)] and #[try_into(owned, ref, ref_mut)]
attributes. These cause the Into and TryInto derives to also implement
derives that return references to the inner fields.#[display(fmt="some shared display text for all enum variants {}")]
attribute on enum.Display trait.regex to cut down compile time.syn 1.0Automatic detection of traits needed for Display format strings
Display format stringsNothing published for this version
Suppress unused_variables warnings in derives
no_std supportunused_variables warnings in derivesExtended Display-like derives to support custom formats
syn v0.15Updated to syn v0.14, quote v0.6 and proc-macro2 v0.4
syn v0.14, quote v0.6 and proc-macro2 v0.4Updated to latest version of syn and quote
syn and quoteResult type is now referenced in the derives using its absolute path
(::std::result::Result) to make sure that the derives don't accidentally use
another Result type that is in scope.### Added - Allow deriving of TryInto - Allow deriving of Deref - Allow deriving of DerefMut
TryIntoDerefDerefMutAllow deriving of Display, Binary, Octal, LowerHex, UpperHex, LowerExp, UpperExp, Pointer
Display, Binary, Octal, LowerHex, UpperHex, LowerExp, UpperExp, PointerIndexIndexMutUpdated to latest version of syn and quote
FromStrsyn and quoteAdd #[allow(missing_docs)] to the Constructor definition
#[allow(missing_docs)] to the Constructor definitionChanged code to work with newer version of the syn library.
syn library.Nothing published for this version
Deriving From, Into and Constructor now works for empty structs.
From, Into and Constructor now works for empty structs.The new() method that is created when deriving Constructor is now public. This makes it a lot more useful.
new() method that is created when deriving Constructor is now public.
This makes it a lot more useful.Derives for Into, Constructor and MulAssign-like
Into, Constructor and MulAssign-likeFrom is now derived for enum variants with multiple fields.Derives for Neg-like and AddAssign-like.
Neg-like and AddAssign-like.From can now be derived for structs with multiple fields.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →