Skip to content

Commit

Permalink
Renamed parser adapter "Ignore" to "Discard"
Browse files Browse the repository at this point in the history
  • Loading branch information
sabitheotome committed Apr 26, 2024
1 parent ecc5197 commit c7f3820
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/parser/adapters/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use crate::stream::traits::Stream;

/// A parser for ignoring the [`Response::Value`] through [`Ignorable`]
///
/// This `struct` is created by the [`Parser::ignore`] method on [`Parser`].
/// This `struct` is created by the [`Parser::discard`] method on [`Parser`].
/// See its documentation for more.
#[must_use = "Parsers are lazy and do nothing unless consumed"]
pub struct Ignore<Par> {
pub struct Discard<Par> {
parser: Par,
}

impl<Par> Ignore<Par> {
impl<Par> Discard<Par> {
pub(crate) fn new(parser: Par) -> Self
where
Par: Parser,
Expand All @@ -21,7 +21,7 @@ impl<Par> Ignore<Par> {
}
}

impl<Par> Parser for Ignore<Par>
impl<Par> Parser for Discard<Par>
where
Par: Parser,
Par::Output: Ignorable,
Expand Down
6 changes: 3 additions & 3 deletions src/parser/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::adapters::{
delimited::Delimited,
eq::{Eq, Ne},
filter::{Filter, FilterNot},
ignore::Ignore,
ignore::Discard,
map::Map,
map_err::MapErr,
opt::Opt,
Expand Down Expand Up @@ -172,12 +172,12 @@ pub trait Parser {
/// .discard().repeat_eoi().evaluate(input);
/// assert_eq!(is_all_alphabetic, true);
/// ```
fn discard(self) -> Ignore<Self>
fn discard(self) -> Discard<Self>
where
Self: Sized,
Self::Output: Ignorable,
{
Ignore::new(self)
Discard::new(self)
}

/// Automatically backtracks if the parsing has failed
Expand Down

0 comments on commit c7f3820

Please sign in to comment.