darling
A proc-macro library for reading attributes into structs when implementing custom derives.
0.24.1
666M downloads/mo
#137 most downloaded on crates.io
TedDriggs/darling
What this package is like to depend on
Last release 3 days ago
20 Aug 2026
Release timing varies
gaps range from 8 days to 9 months
Most releases are documented
notes for 57 of 65 stable releases
3 versions withdrawn
withdrawn after publishing
9 years old
69 releases · first in 2017
4 releases in the last 12 months
see the full history below
Release timeline
69 releases · May 2017 to Aug 2026Releases
latest 60 of 69-
0.24.120 Aug 2026 -
0.24.030 Jul 2026 -
0.23.003 Dec 2025Release notes
Open source →- Bump MSRV to 1.88.0; there have been no code changes that caused this, but due to dependency issues CI no longer works on 1.56.0 #357
-
0.22.002 Dec 2025 withdrawnRelease notes
Open source →YANKED Pinned dependencies made this version cause conflicts with other crates.
- BREAKING: Remove
fnvdependency, as runtime performance gain does not justify additional dependency. This was exposed to users ofdarling::usage, so it may be breaking for them #373 - Add
#[darling(default = || expr(val))]support, allowing a closure where a path was previously required #380 - Preserve span information for paths given to
darling::util::Callableas literal strings - Fix some documentation typos
Release notes
Open source →- BREAKING: Remove
fnvdependency, as runtime performance gain does not justify additional dependency. This was exposed to users ofdarling::usage, so it may be breaking for them #373 - Add
#[darling(default = || expr(val))]support, allowing a closure where a path was previously required #380 - Preserve span information for paths given to
darling::util::Callableas literal strings - Fix some documentation typos
- BREAKING: Remove
-
0.21.322 Aug 2025 -
0.21.214 Aug 2025Release notes
Open source →- Add
#[darling(from_expr = ...)]when derivingFromMetato support overriding the key-value form #369 - Keep parsing the body and type params even if there are errors from parsing attributes. #7
- Support
#[darling(with = ...)]on thegenericsfield when derivingFromDeriveInput. - Return an error, rather than panicking, when doing shape validation on a
union. #365
Release notes
Open source →- Add
#[darling(from_expr = ...)]when derivingFromMetato support overriding the key-value form #369 - Keep parsing the body and type params even if there are errors from parsing attributes. #7
- Support
#[darling(with = ...)]on thegenericsfield when derivingFromDeriveInput. - Return an error, rather than panicking, when doing shape validation on a
union. #365
- Add
-
0.21.104 Aug 2025 -
0.21.010 Jul 2025Release notes
Open source →- Potentially breaking: Emit error when an attribute path is present in both
attributesandforward_attrs. #336 - Support parsing attributes which contain keywords #238
- Add
SpannedValue::into_inner#342 - Add
#[darling(derive_syn_parse)]to also implsyn::parse::Parsewhen derivingFromMeta#285 - Make
impl FromMeta for syn::TypePathsupport both quote-wrapped and bare values #351 - Add
util::PreservedStrExpr#346 - Impl
UsesTypeParamsandUsesLifetimesforWithOriginal#215 - Update error message emitted by
<() as FromMeta>::from_listto allow use of()as a#[darling(flatten)]target #353
Release notes
Open source →- Potentially breaking: Emit error when an attribute path is present in both
attributesandforward_attrs. #336 - Support parsing attributes which contain keywords #238
- Add
SpannedValue::into_inner#342 - Add
#[darling(derive_syn_parse)]to also implsyn::parse::Parsewhen derivingFromMeta#285 - Make
impl FromMeta for syn::TypePathsupport both quote-wrapped and bare values #351 - Add
util::PreservedStrExpr#346 - Impl
UsesTypeParamsandUsesLifetimesforWithOriginal#215 - Update error message emitted by
<() as FromMeta>::from_listto allow use of()as a#[darling(flatten)]target #353
- Potentially breaking: Emit error when an attribute path is present in both
-
0.20.1128 Mar 2025Release notes
Open source →- Support
#[darling(with = ...)]on thedatafield when derivingFromDeriveInput. This allows the use of simpler receiver types, such as aVecof enum variants. - Bump version of
proc-macro2to 1.0.86. - Accept closures for
#[darling(with = ...)]on fields inFromDeriveInput,FromMeta,FromField, etc. #309 - Add
darling::util::Callableto accept a path or closure as a meta-item expression - Add
#[darling(from_word = ...)]and#[darling(from_none = ...)]to control shorthand and fallback behaviors for structs and enums derivingFromMeta#320 - Add
FromMetaimpl forsyn::ExprRange#329
Release notes
Open source →- Support
#[darling(with = ...)]on thedatafield when derivingFromDeriveInput. This allows the use of simpler receiver types, such as aVecof enum variants. - Bump version of
proc-macro2to 1.0.86. - Accept closures for
#[darling(with = ...)]on fields inFromDeriveInput,FromMeta,FromField, etc. #309 - Add
darling::util::Callableto accept a path or closure as a meta-item expression - Add
#[darling(from_word = ...)]and#[darling(from_none = ...)]to control shorthand and fallback behaviors for structs and enums derivingFromMeta#320 - Add
FromMetaimpl forsyn::ExprRange#329
- Support
-
0.20.1009 Jul 2024 -
0.20.915 May 2024 -
0.20.823 Feb 2024Release notes
Open source →- Add
#[darling(with = ...)]support toattrsmagic field to allow using custom receiver types forattrs#273
- Add
-
0.20.722 Feb 2024 -
0.20.614 Feb 2024 -
0.20.531 Jan 2024Release notes
Open source →- Add
Flag::spaninherent method, asFlagcan no longer implsyn::spanned::Spanned#242
- Add
-
0.20.429 Jan 2024Release notes
Open source →- Accept bare paths in
#[darling(default = ...)]#258 - Add
FromMetaimpl forPathBuf#259 - Improve
FromMetaimplementation for enums #260- Properly implement unit arms in
FromMeta::from_listto provide a consistent API for heterogeneous enums that include a mix of unit, newtype and struct variants - Add
#[darling(word)]attribute for unit enum variants (See #63 for details)
- Properly implement unit arms in
- Accept bare paths in
-
0.20.312 Jul 2023 -
0.20.102 May 2023 -
0.20.027 Apr 2023Release notes
Open source →- Bump syn to version 2, courtesy of @jonasbb #227
Breaking Changes
-
Replace all occurrences of syn::NestedMeta with darling::ast::NestedMeta.
-
Replacement for the deprecated AttributeArgs:
// Before parse_macro_input!(args as AttributeArgs); // After match NestedMeta::parse_meta_list(args) { Ok(v) => v, Err(e) => { return TokenStream::from(Error::from(e).write_errors()); } };- In GenericParamExt,
LifetimeDefis nowLifetimeParam. - In GenericParamExt,
as_lifetime_defis renamed toas_lifetime_param. - Flag and SpannedValue no longer implement
syn::spanned::Spanned. - The MSRV (minimum supported Rust version) is now 1.56, because of syn.
Deprecation Warnings
In previous versions of
darling, arbitrary expressions were passed in attributes by wrapping them in quotation marks. v0.20.0 preserves this behavior forsyn::Expr, but as a result a field expecting asyn::Exprcannot accept a string literal - it will incorrectly attempt to parse the contents. If this is an issue for you, please add a comment to #229. -
0.14.409 Mar 2023 -
0.14.306 Feb 2023Release notes
Open source →- Re-export
synfromdarlingto avoid requiring that consuming crates have asyndependency. - Change
<SpannedValue<T> as FromMeta>impl to more precisely capture the value span, as opposed to the span of the entire item. - Add
darling::util::{AsShape, Shape, ShapeSet}to improve "shape" validation for structs and variants. #222
- Re-export
-
0.14.226 Oct 2022 -
0.14.128 Apr 2022 -
0.14.013 Apr 2022Release notes
Open source →- BREAKING CHANGE: Remove many trait impls from
util::Flag. This type had a number of deref and operator impls that made it usable as sort-of-a-boolean. Real-world usage showed this type is more useful if it's able to carry a span for good errors, and that most of those impls were unnecessary. #179 - Remove need for
#[darling(default)]onOption<T>andFlagfields #161 - Improve validation of enum shapes #178
- Bump
proc-macro2dependency to 1.0.37 #180 - Bump
quotedependency to 1.0.18 #180 - Bump
syndependency to 1.0.91 #180
- BREAKING CHANGE: Remove many trait impls from
-
0.13.406 Apr 2022 -
0.13.305 Apr 2022 -
0.13.201 Apr 2022 -
0.13.107 Dec 2021 -
0.13.020 May 2021 -
0.13.0-beta21 Apr 2021 pre-releaseRelease notes
Open source → -
0.12.420 Apr 2021 -
0.12.308 Apr 2021 -
0.12.223 Feb 2021 -
0.12.122 Feb 2021 -
0.12.005 Jan 2021Release notes
Open source →- POSSIBLY BREAKING: Derived impls of
FromDeriveInput,FromField,FromVariant, andFromTypeParamwill now error when encountering an attributedarlinghas been asked to parse that isn't a supported shape. Any crates usingdarlingthat relied on those attributes being silently ignored could see new errors reported in their dependent crates. #113 - Impl
syn::spanned::Spannedfordarling::util::SpannedValue#113 - Add
darling::util::parse_attribute_to_meta_listto provide useful errors during attribute parsing #113 - Add
impl From<syn::Error> for Errorto losslessly propagatesynerrors #116
- POSSIBLY BREAKING: Derived impls of
-
0.11.014 Dec 2020 -
0.10.310 Dec 2020 withdrawn -
0.10.230 Oct 2019 -
0.10.125 Sep 2019 -
0.10.015 Aug 2019 -
0.9.020 Mar 2019 -
0.8.618 Mar 2019Release notes
Open source →- Added "did you mean" suggestions for unknown fields behind the
suggestionsflag #60 - Added
Error::unknown_field_with_altsto support the suggestion use-case. - Added
ast::Fields::lenandast::Fields::is_emptymethods.
- Added "did you mean" suggestions for unknown fields behind the
-
0.8.504 Feb 2019Release notes
Open source →- Accept unquoted positive numeric literals #52
- Add
FromMetato thesyn::Litenum and its variants - Improve error message for unexpected literal formats to not say "other"
-
0.8.404 Feb 2019Release notes
Open source →- Use
syn::Errorto provide precise errors beforeproc_macro::Diagnosticis available - Add
diagnosticsfeature flag to toggle between stable and unstable error backends - Attach error information in more contexts
- Add
allow_unknown_fieldsto support parsing the same attribute multiple times for different macros #51 - Proc-macro authors will now see better errors in
darlingattributes
- Use
-
0.8.321 Jan 2019Release notes
Open source →- Attach spans to errors in generated trait impls #37
- Attach spans to errors for types with provided bespoke implementations
- Deprecate
set_spanfrom 0.8.2, as spans should never be broadened after being initially set
-
0.8.218 Jan 2019Release notes
Open source →- Add spans to errors to make quality warnings and errors easy in darling. This is blocked on diagnostics stabilizing.
- Add
darling::util::SpannedValueso proc-macro authors can remember position information alongside parsed values.
-
0.8.112 Dec 2018Nothing published for this version
-
0.8.002 Oct 2018 -
0.7.024 Jul 2018Release notes
Open source →- Update dependencies on
synandproc-macro2 - Add
util::IdentString, which acts as an Ident or its string equivalent
- Update dependencies on
-
0.6.323 May 2018 -
0.6.222 May 2018 -
0.6.117 May 2018 -
0.6.016 May 2018Release notes
Open source →Breaking Changes
- Renamed
FromMetaItemtoFromMeta, and renamedfrom_meta_itemmethod tofrom_meta - Added dedicated
derive(FromMetaItem)which panics and redirects users toFromMeta
- Renamed
-
0.5.010 May 2018Release notes
Open source →- Add
ast::Genericsandast::GenericParamto work with generics in a manner similar toast::Data - Add
ast::GenericParamExtto support alternate representations of generic parameters - Add
util::WithOriginalto get a parsed representation and syn's own struct for a syntax block - Add
FromGenericsandFromGenericParamtraits (without derive support) - Change generated code for
genericsmagic field to invokeFromGenericstrait during parsing - Add
FromTypeParamtrait #30. Thanks to @upsuper
- Add
-
0.4.005 Apr 2018 -
0.3.302 Apr 2018 withdrawn -
0.3.213 Mar 2018 -
0.3.107 Mar 2018 -
0.3.027 Jan 2018 -
0.2.205 Dec 2017