Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pacak opened this issue Oct 30, 2023 · 0 comments
Open

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

pacak opened this issue Oct 30, 2023 · 0 comments

Comments

@pacak
Copy link
Owner

pacak commented Oct 30, 2023

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)
          }
      }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant