mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-18 09:06:27 +00:00
28 lines
471 B
Rust
28 lines
471 B
Rust
#[macro_use]
|
|
extern crate darling;
|
|
#[macro_use]
|
|
extern crate syn;
|
|
#[macro_use]
|
|
extern crate quote;
|
|
|
|
use darling::FromDeriveInput;
|
|
|
|
#[derive(Debug, Clone, FromMeta)]
|
|
struct Wrapper<T>(pub T);
|
|
|
|
#[derive(Debug, FromDeriveInput)]
|
|
#[darling(attributes(hello))]
|
|
struct Foo<T> {
|
|
lorem: Wrapper<T>,
|
|
}
|
|
|
|
#[test]
|
|
fn expansion() {
|
|
let di = parse_quote! {
|
|
#[hello(lorem = "Hello")]
|
|
pub struct Foo;
|
|
};
|
|
|
|
Foo::<String>::from_derive_input(&di).unwrap();
|
|
}
|