Skip to content

Commit

Permalink
refactor: Rename range_of to recognize
Browse files Browse the repository at this point in the history
This collides with the equivalent function in `combinator` but it can
trivial be renamed using `recognize as recognize_range` if that is a
problem.
  • Loading branch information
Marwes committed Aug 7, 2017
1 parent 357e162 commit 57b58c9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ where
}
}

pub struct RangeOf<P>(P);
pub struct Recognize<P>(P);

impl<P> Parser for RangeOf<P>
impl<P> Parser for Recognize<P>
where
P: Parser,
P::Input: RangeStream,
Expand All @@ -64,21 +64,21 @@ where
///
/// ```
/// # extern crate combine;
/// # use combine::range::range_of;
/// # use combine::range::recognize;
/// # use combine::char::letter;
/// # use combine::*;
/// # fn main() {
/// let mut parser = range_of(skip_many1(letter()));
/// let mut parser = recognize(skip_many1(letter()));
/// assert_eq!(parser.parse("hello world"), Ok(("hello", " world")));
/// assert!(parser.parse("!").is_err());
/// # }
/// ```
#[inline(always)]
pub fn range_of<P>(parser: P) -> RangeOf<P>
pub fn recognize<P>(parser: P) -> Recognize<P>
where
P: Parser,
{
RangeOf(parser)
Recognize(parser)
}

/// Zero-copy parser which reads a range of length `i.len()` and succeds if `i` is equal to that
Expand Down

0 comments on commit 57b58c9

Please sign in to comment.