Skip to content

Releases: TedDriggs/darling

v0.20.10

09 Jul 13:47
Compare
Choose a tag to compare
  • Add #[allow(clippy::manual_unwrap_or_default)] to all generated impls to avoid causing clippy fails in crates using darling #296
  • Properly initialize attrs magic field in derived FromAttributes impls #297

v0.20.8

23 Feb 21:57
Compare
Choose a tag to compare
  • Add #[darling(with = ...)] support to attrs magic field to allow using custom receiver types for attrs #273

v0.20.7

22 Feb 22:12
Compare
Choose a tag to compare
  • Add #[darling(flatten)] to allow forwarding unknown fields to another struct #146
  • Don't suggest names of skipped fields in derived impls #268

v0.20.6

14 Feb 21:18
Compare
Choose a tag to compare
  • Fix some missing syn invisible group handling in FromMeta impls #263
  • Fix misleading error message on Error::unexpected_type so it no longer implies the type was a literal #264
  • Impl FromMeta Vec of literals, e.g. LitStr #265

v0.20.5

14 Feb 20:59
Compare
Choose a tag to compare
  • Add Flag::span inherent method, as Flag can no longer impl syn::spanned::Spanned #242

v0.20.4

29 Jan 21:50
Compare
Choose a tag to compare
  • Accept bare paths in #[darling(default = ...)] #258
  • Add FromMeta impl for PathBuf #259
  • Improve FromMeta implementation for enums #260
    • Properly implement unit arms in FromMeta::from_list to 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)

v0.20.3

12 Jul 18:59
Compare
Choose a tag to compare
  • Add FromMeta impl for u128 and i128 #243

This release also includes features originally slated for 0.20.2, as that was never published.

  • Allow darling users to omit quotation marks for paths and idents #236
  • Add new util functions for controlling how quotation marks are handled when reading into Expr fields #235

v0.20.1

02 May 21:45
Compare
Choose a tag to compare
  • Add Clone impl for NestedMeta #230

v0.20.0

27 Apr 20:35
Compare
Choose a tag to compare

v0.20.0 (April 27, 2023)

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, LifetimeDef is now LifetimeParam.
  • In GenericParamExt, as_lifetime_def is renamed to as_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 for syn::Expr, but as a result a field expecting a syn::Expr cannot 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.

v0.14.4

09 Mar 21:05
Compare
Choose a tag to compare
  • Add support for child diagnostics when diagnostics feature enabled #224