TedDriggs / darling

A Rust proc-macro attribute parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vec of Path

PolyProgrammist opened this issue · comments

Hi, is it possible to use:
#[macro_name(field = [a, b])]

@TedDriggs

Certainly would be possible, but by convention that's normally written in macros as #[macro_name(field(a, b))] - see #[derive(Debug, Clone, ...)] as an example. That's available as darling::util::PathList

On further reflection, there are already two supported ways to handle this:

  1. Use darling::util::PathList as described above.
  2. Use #[darling(with = ...)] or #[darling(and_then = ...)] to accept a [syn::Expr] as the right-hand value and then validate that the expression is an array of paths or idents.

Given the existence of both these options, I am not inclined to add a new FromMeta impl.