File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,41 @@ array_choice_parser!(
350
350
30 31 32
351
351
) ;
352
352
353
+ #[ cfg( feature = "std" ) ]
354
+ impl < Input , P > ChoiceParser < Input > for Vec < P >
355
+ where
356
+ Input : Stream ,
357
+ P : Parser < Input > ,
358
+ {
359
+
360
+ type Output = P :: Output ;
361
+ type PartialState = <[ P ] as ChoiceParser < Input > >:: PartialState ;
362
+
363
+ parse_mode_choice ! ( Input ) ;
364
+ #[ inline]
365
+ fn parse_mode_choice < M > (
366
+ & mut self ,
367
+ mode : M ,
368
+ input : & mut Input ,
369
+ state : & mut Self :: PartialState ,
370
+ ) -> ParseResult < Self :: Output , <Input as StreamOnce >:: Error >
371
+ where
372
+ M : ParseMode ,
373
+ {
374
+ if mode. is_first ( ) {
375
+ self [ ..] . parse_first ( input, state)
376
+ } else {
377
+ self [ ..] . parse_partial ( input, state)
378
+ }
379
+ }
380
+ fn add_error_choice (
381
+ & mut self ,
382
+ error : & mut Tracked < <Input as StreamOnce >:: Error >
383
+ ) {
384
+ self [ ..] . add_error_choice ( error)
385
+ }
386
+ }
387
+
353
388
#[ derive( Copy , Clone ) ]
354
389
pub struct Choice < P > ( P ) ;
355
390
You can’t perform that action at this time.
0 commit comments