Name Description Size
automatic_bounds.rs 1732
consume_fields.rs This example shows how to do struct and field parsing using darling. 5375
expr_with.rs 482
fallible_read.rs This example demonstrates techniques for performing custom error handling in a derive-input receiver. 1. Using `darling::Result` as a carrier to preserve the error for later display 1. Using `Result<T, syn::Meta>` to attempt a recovery in imperative code 1. Using the `map` darling meta-item to post-process a field before returning 1. Using the `and_then` darling meta-item to post-process the receiver before returning 2853
heterogeneous_enum_and_word.rs This example demonstrates: - The behavior of a derived `FromMeta` implementation for heterogeneous enums (i.e. enums that include a mix of unit, newtype and struct variants). - Using `#[darling(word)]` to specify a unit variant to use when a receiver field is specified without a value (i.e. a unit variant to use for deriving the `FromMeta::from_word` method). - Using `#[darling(default)]` on a receiver field to fall back to `Default::default()` for the enum's value when the receiver field is not specified by the caller. 2392
shorthand_or_long_field.rs Example showing potentially-nested meta item parsing with `darling::util::Override`. Based on https://stackoverflow.com/q/68046070/86381 by https://github.com/peterjoel 2202
supports_struct.rs 1231