• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // pest. The Elegant Parser
2 // Copyright (c) 2018 Dragoș Tiselice
3 //
4 // Licensed under the Apache License, Version 2.0
5 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
6 // license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. All files in the project carrying such notice may not be copied,
8 // modified, or distributed except according to those terms.
9 
10 use error::Error;
11 use iterators::Pairs;
12 use RuleType;
13 
14 /// A trait with a single method that parses strings.
15 pub trait Parser<R: RuleType> {
16     /// Parses a `&str` starting from `rule`.
parse(rule: R, input: &str) -> Result<Pairs<R>, Error<R>>17     fn parse(rule: R, input: &str) -> Result<Pairs<R>, Error<R>>;
18 }
19