pacak/bpaf

impl<T> Parser<T> for Vec<Box<dyn Parser<T>>>

Opened this issue · 0 comments

Should make choice a bit more efficient still. todo!() needs to use some bits from ParseOrElse::eval

  impl<T> Parser<T> for Vec<Box<dyn Parser<T>>> {
      fn eval(&self, args: &mut State) -> Result<T, Error> {
          todo!()
      }

      fn meta(&self) -> Meta {
          let xs = self
              .iter()
              .filter_map(|p| match p.meta() {
                  Meta::Skip => None,
                  m => Some(m),
              })
              .collect::<Vec<_>>();
          if xs.is_empty() {
              Meta::Skip
          } else {
              Meta::Or(xs)
          }
      }
  }