#[allow(clippy::manual_unwrap_or_default)]
to all generated impls to avoid causing clippy fails in crates using darling
#296attrs
magic field in derived FromAttributes
impls #297from_none
is called on their type #249FromMeta
impls for the std::num::NonZero*
types #288FromMeta
impls when the parsed value is too large for the receiver type #289#[darling(with = ...)]
support to attrs
magic field to allow using custom receiver types for attrs
#273#[darling(flatten)]
to allow forwarding unknown fields to another struct #146FromMeta
impls #263Error::unexpected_type
so it no longer implies the type was a literal #264FromMeta
Vec
of literals, e.g. LitStr
#265Flag::span
inherent method, as Flag
can no longer impl syn::spanned::Spanned
#242#[darling(default = ...)]
#258FromMeta
impl for PathBuf
#259FromMeta
implementation for enums #260FromMeta::from_list
to provide a consistent API for heterogeneous enums that include a mix of unit, newtype and struct variants#[darling(word)]
attribute for unit enum variants (See #63 for details)FromMeta
impl for u128
and i128
#243Expr
fields #235Clone
impl for NestedMeta
#230Replace 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()); } };
LifetimeDef
is now LifetimeParam
.as_lifetime_def
is renamed to as_lifetime_param
.syn::spanned::Spanned
.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.
diagnostics
feature enabled #224syn
from darling
to avoid requiring that consuming crates have a syn
dependency.<SpannedValue<T> as FromMeta>
impl to more precisely capture the value span, as opposed to the span of the entire item.darling::util::{AsShape, Shape, ShapeSet}
to improve “shape” validation for structs and variants. #222FromMeta
will now error on literals, rather than silently ignoring them. #193#[darling(attributes(...))]
without specifying any attributes would emit code that did not compile. #183Clone
for darling::Error
#184From<darling::Error> for syn::Error
#184Error::span
and Error::explicit_span
methods #184util::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#[darling(default)]
on Option<T>
and Flag
fields #161proc-macro2
dependency to 1.0.37 #180quote
dependency to 1.0.18 #180syn
dependency to 1.0.91 #180FromMeta
for syn::Visibility
#173error::Accumulator
for dealing with multiple errors #164FromMeta
for syn::Type
and its variants #172FromMeta
for syn::ExprPath
#169FromAttributes
trait and macro #151#[darling(...)]
attributes #130Copy
for SpannedValue<T: Copy>
SpannedValue::map_ref
and_then
to derive macros for darling
FromMeta
impl for char
not to panic #126FromMeta
for HashMap<Ident, V>
and HashMap<Path, V>
FromMeta
for syn::ExprArray
#122unreachable
from darling::ast::Data
#123darling::ast::Data::try_empty_from
to avoid panics when trying to read a union body #123FromDeriveInput
, FromField
, FromVariant
, and FromTypeParam
will now error when encountering an attribute darling
has been asked to parse that isn't a supported shape. Any crates using darling
that relied on those attributes being silently ignored could see new errors reported in their dependent crates. #113syn::spanned::Spanned
for darling::util::SpannedValue
#113darling::util::parse_attribute_to_meta_list
to provide useful errors during attribute parsing #113impl From<syn::Error> for Error
to losslessly propagate syn
errors #116discriminant
magic field when deriving FromVariant
#105darling_core::{codegen, options}
private #58Override::as_mut
: #66suggestions
flag #60Error::unknown_field_with_alts
to support the suggestion use-case.ast::Fields::len
and ast::Fields::is_empty
methods.FromMeta
to the syn::Lit
enum and its variantssyn::Error
to provide precise errors before proc_macro::Diagnostic
is availablediagnostics
feature flag to toggle between stable and unstable error backendsallow_unknown_fields
to support parsing the same attribute multiple times for different macros #51darling
attributesset_span
from 0.8.2, as spans should never be broadened after being initially setdarling::util::SpannedValue
so proc-macro authors can remember position information alongside parsed values.syn
to 0.15 #44. Thanks to @hcplsyn
and proc-macro2
util::IdentString
, which acts as an Ident or its string equivalentUses*
traits in where predicatesusage
module for tracking type param and lifetime usage in generic declarationsFromMeta
bounds to type parameters only used by skipped fields #40syn
update broke shape validation #36FromMetaItem
to FromMeta
, and renamed from_meta_item
method to from_meta
derive(FromMetaItem)
which panics and redirects users to FromMeta
ast::Generics
and ast::GenericParam
to work with generics in a manner similar to ast::Data
ast::GenericParamExt
to support alternate representations of generic parametersutil::WithOriginal
to get a parsed representation and syn's own struct for a syntax blockFromGenerics
and FromGenericParam
traits (without derive support)generics
magic field to invoke FromGenerics
trait during parsingFromTypeParam
trait #30. Thanks to @upsuperproc-macro
, quote
, and syn
#26. Thanks to @hcplYANKED
Default
on darling::Ignored
(fixes #25).syn
to 0.12 #20. Thanks to @Eijebongquote
to 0.4 #20. Thanks to @Eijebongbody
in derived FromDeriveInput
structs to data
to stay in sync with syn
data
in derived FromVariant
structs to fields
to stay in sync with syn
lazy_static
to 1.0 #15. Thanks to @Eijebongimpl FromMetaItem
for integer types #15