1+ use std:: marker:: PhantomData ;
2+
13use crate :: { InputTrait , Parser , SetContext } ;
24
3- pub struct FlattenParser < P > {
5+ pub struct FlattenParser < P , CIn > {
46 parser : P ,
7+ _marker : PhantomData < CIn > ,
58}
6- impl < P > FlattenParser < P > {
9+
10+ impl < P , CIn > FlattenParser < P , CIn > {
711 pub ( crate ) fn new ( parser : P ) -> Self {
8- Self { parser }
12+ Self {
13+ parser,
14+ _marker : PhantomData ,
15+ }
916 }
1017}
11- impl < I , C , P > Parser < I , C > for FlattenParser < P >
18+
19+ impl < I , COut , CIn , P > Parser < I , COut > for FlattenParser < P , CIn >
1220where
1321 I : InputTrait ,
14- P : Parser < I , C > ,
15- P :: Output : Parser < I , C , Error = P :: Error > ,
22+ P : Parser < I , COut > ,
23+ P :: Output : Parser < I , CIn , Error = P :: Error > ,
1624{
17- type Output = <P :: Output as Parser < I , C > >:: Output ;
25+ type Output = <P :: Output as Parser < I , CIn > >:: Output ;
1826 type Error = P :: Error ;
1927 fn parse ( & mut self , input : & mut I ) -> Result < Self :: Output , Self :: Error > {
2028 match self . parser . parse ( input) {
@@ -23,11 +31,11 @@ where
2331 }
2432 }
2533}
26- impl < C , P > SetContext < C > for FlattenParser < P >
34+ impl < P , COut , CIn > SetContext < COut > for FlattenParser < P , CIn >
2735where
28- P : SetContext < C > ,
36+ P : SetContext < COut > ,
2937{
30- fn set_context ( & mut self , ctx : C ) {
38+ fn set_context ( & mut self , ctx : COut ) {
3139 self . parser . set_context ( ctx)
3240 }
3341}
0 commit comments