Skip to content

Commit

Permalink
Forward NONCONSUMPTION_IS_OK in IterParser implementations (#718)
Browse files Browse the repository at this point in the history
* Added NONCONSUMPTION_IS_OK to IterParser implementations

* Fix NONCONSUMPTION_IS_OK for Flatten

---------

Co-authored-by: Jojakim Stahl <j.stahl@demig.de>
  • Loading branch information
jojastahl and Jojakim Stahl authored Feb 3, 2025
1 parent 4dc3098 commit 762ab3d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/combinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = A::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -166,6 +168,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = A::NONCONSUMPTION_IS_OK;

fn make_iter<M: Mode>(
&self,
inp: &mut InputRef<'src, '_, I, E>,
Expand Down Expand Up @@ -310,6 +314,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = A::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -382,6 +388,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = A::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -461,6 +469,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = A::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -1057,6 +1067,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = B::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -1131,6 +1143,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = B::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -1881,6 +1895,8 @@ where
where
I: 'src;

const NONCONSUMPTION_IS_OK: bool = A::NONCONSUMPTION_IS_OK;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -2062,6 +2078,8 @@ where
{
type IterState<M: Mode> = bool;

const NONCONSUMPTION_IS_OK: bool = true;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down Expand Up @@ -2177,6 +2195,11 @@ where
{
type IterState<M: Mode> = (A::IterState<M>, Option<M::Output<O::IntoIter>>);

// A::NONCONSUMPTION_IS_OK cannot be used because if we are iterating
// over O, we are not consuming any input (input has probably
// already been comsumed when constructing O)
const NONCONSUMPTION_IS_OK: bool = true;

#[inline(always)]
fn make_iter<M: Mode>(
&self,
Expand Down

0 comments on commit 762ab3d

Please sign in to comment.