Skip to content

Releases: TedDriggs/darling

v0.20.4

29 Jan 21:50

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

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

Choose a tag to compare

  • Add Clone impl for NestedMeta #230

v0.20.0

27 Apr 20:35

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

Choose a tag to compare

  • Add support for child diagnostics when diagnostics feature enabled #224

v0.14.3

06 Feb 21:57

Choose a tag to compare

  • Re-export syn from darling to avoid requiring that consuming crates have a syn dependency.
  • 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

v0.14.2

26 Oct 19:40

Choose a tag to compare

  • Derived impls of FromMeta will now error on literals, rather than silently ignoring them. #193
  • Don't include property paths in compile errors when spans are available. #203

v0.14.1

08 Sep 19:46

Choose a tag to compare

  • Fix a bug where using a trait that accepts #[darling(attributes(...))] without specifying any attributes would emit code that did not compile. #183
  • Impl Clone for darling::Error #184
  • Impl Fromdarling::Error for syn::Error #184
  • Add Error::span and Error::explicit_span methods #184

v0.14.0

13 Apr 16:45

Choose a tag to compare

  • 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)] on Option<T> and Flag fields #161
  • Improve validation of enum shapes #178
  • Bump proc-macro2 dependency to 1.0.37 #180
  • Bump quote dependency to 1.0.18 #180
  • Bump syn dependency to 1.0.91 #180

v0.13.4

06 Apr 14:13

Choose a tag to compare

  • Impl FromMeta for syn::Visibility #173