diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-10-27 01:11:58 -0400 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-10-27 01:11:58 -0400 |
| commit | 83e3f07adf9ae047bcb2096a9c7a0352ab4ae123 (patch) | |
| tree | 70fa704045f9529892a4e5aa222e691c4e559fe4 /src | |
| parent | e6037210c61b3da6d51faf0b4b1b4e3110274831 (diff) | |
| download | mon-83e3f07adf9ae047bcb2096a9c7a0352ab4ae123.tar.gz | |
remove opt function and replace it with method
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -184,6 +184,10 @@ pub trait Parser<I: Input>: Sized { fn ignore(self) -> impl Parser<I, Output = ()> { Ignore { parser: self } } + + fn opt(self) -> impl Parser<I, Output = Option<Self::Output>> { + Opt { parser: self } + } } impl<I, O, F> Parser<I> for F @@ -686,14 +690,6 @@ where } } -pub fn opt<I, P>(parser: P) -> impl Parser<I, Output = Option<P::Output>> -where - I: Input, - P: Parser<I>, -{ - Opt { parser } -} - struct VerifyInput<P, C> { parser: P, checker: C, |
