Debian Codegraph @

third_party/rust/darling/tests/generics.rs

raw
1 #![allow(dead_code)]
2
3 use darling::{FromDeriveInput, FromMeta};
4 use syn::parse_quote;
5
6 #[derive(Debug, Clone, FromMeta)]
7 struct Wrapper<T>(pub T);
8
9 #[derive(Debug, FromDeriveInput)]
10 #[darling(attributes(hello))]
11 struct Foo<T> {
12 lorem: Wrapper<T>,
13 }
14
15 #[test]
16 fn expansion() {
17 let di = parse_quote! {
18 #[hello(lorem = "Hello")]
19 pub struct Foo;
20 };
21
22 Foo::<String>::from_derive_input(&di).unwrap();
23 }