TedDriggs / darling

A Rust proc-macro attribute parser
MIT License
983 stars 66 forks source link

serde_json multi-typed literal parsing #308

Open nyurik opened 20 hours ago

nyurik commented 20 hours ago

I am implementing #[attr(default = <literal>)], and my value can be multi-typed depending on what it gets attached to. The serde_json::Value is the format I will eventually have to work with. Darling seem to have the needed from_value() functions, but I am not too certain how to use it to convert from a syn::Lit into serde_json::Value, possibly via some magical match statement? Thx!