1- use syn:: { parse:: Parse , Ident , Token } ;
1+ use syn:: { parse:: Parse , Token , Type } ;
22
33pub ( crate ) struct TestContextArgs {
4- pub ( crate ) context_type : Ident ,
4+ pub ( crate ) context_type : Type ,
55 pub ( crate ) skip_teardown : bool ,
66}
77
88impl Parse for TestContextArgs {
99 fn parse ( input : syn:: parse:: ParseStream ) -> syn:: Result < Self > {
1010 let mut skip_teardown = false ;
11- let mut context_type: Option < Ident > = None ;
11+ let mut context_type: Option < Type > = None ;
1212
1313 while !input. is_empty ( ) {
1414 let lookahead = input. lookahead1 ( ) ;
@@ -18,10 +18,8 @@ impl Parse for TestContextArgs {
1818 }
1919 let _ = input. parse :: < kw:: skip_teardown > ( ) ?;
2020 skip_teardown = true ;
21- } else if lookahead. peek ( Ident ) {
22- if context_type. is_some ( ) {
23- return Err ( input. error ( "expected only a single type identifier" ) ) ;
24- }
21+ } else if context_type. is_none ( ) {
22+ // Parse any valid Rust type, including generic types
2523 context_type = Some ( input. parse ( ) ?) ;
2624 } else if lookahead. peek ( Token ! [ , ] ) {
2725 let _ = input. parse :: < Token ! [ , ] > ( ) ?;
0 commit comments