Registry / other / darling

darling

JSON →
library0.23.0rscratesunverified

A proc-macro library for reading attributes into structs when implementing custom derives.

# Cargo.toml [dependencies] darling = "0.23.0"
INSTALL
IMPORT
SIG · DARLING
D
darling
otherrustv0.23.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FromDeriveInput
✓ use darling::FromDeriveInput;

Parses custom derive attributes into a struct.

use darling::FromDeriveInput; use syn::DeriveInput; #[derive(FromDeriveInput)] #[darling(attributes(my_attr))] struct MyOptions { name: String, count: Option<usize>, } fn main() { let input: DeriveInput = syn::parse_str("#[derive(MyTrait)] #[my_attr(name = \"test\")] struct Foo;").unwrap(); let opts = MyOptions::from_derive_input(&input).unwrap(); println!("Name: {}", opts.name); }
Debug
Known issues
gotchaRequires understanding of proc-macro and syn crate.
fix
Familiarize with syn and quote crates for derive macros.
affects: >=0.10.0
Upgrade
Version history
0.23.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
darling — cargo add darling · libregistry