use nom::sequence::delimited;
use nom::bytes::complete::tag;
let mut parser = delimited(tag("("), tag("abc"), tag(")"));
does not compile:
error[E0283]: type annotations needed
--> src\main.rs:43:32
|
43 | let mut parser = delimited(tag("("), tag("abc"), tag(")"));
| --------- ^^^ cannot infer type of the type parameter `Error` declared on the function `tag`
| |
| type must be known at this point
|
= note: cannot satisfy `_: ParseError<_>`
= help: the following types implement trait `ParseError<I>`:
()
(I, nom::error::ErrorKind)
VerboseError<I>
nom::error::Error<I>
note: required by a bound in `delimited`
--> C:\Users\bart\.cargo\registry\src\github.com-1ecc6299db9ec823\nom-7.1.3\src\sequence\mod.rs:172:36
|
172 | pub fn delimited<I, O1, O2, O3, E: ParseError<I>, F, G, H>(
| ^^^^^^^^^^^^^ required by this bound in `delimited`
help: consider specifying the generic arguments
|
43 | let mut parser = delimited(tag::<&str, Input, Error>("("), tag("abc"), tag(")"));
| ++++++++++++++++++++++
error[E0283]: type annotations needed
--> src\main.rs:43:32
|
43 | let mut parser = delimited(tag("("), tag("abc"), tag(")"));
| ^^^ cannot infer type of the type parameter `Input` declared on the function `tag`
|
= note: multiple `impl`s satisfying `_: Compare<&str>` found in the `nom` crate:
- impl<'a, 'b> Compare<&'b str> for &'a [u8];
- impl<'a, 'b> Compare<&'b str> for &'a str;
note: required by a bound in `nom::bytes::complete::tag`
--> C:\Users\bart\.cargo\registry\src\github.com-1ecc6299db9ec823\nom-7.1.3\src\bytes\complete.rs:36:22
|
36 | Input: InputTake + Compare<T>,
| ^^^^^^^^^^ required by this bound in `tag`
help: consider specifying the generic arguments
|
43 | let mut parser = delimited(tag::<&str, Input, Error>("("), tag("abc"), tag(")"));
| ++++++++++++++++++++++
error[E0283]: type annotations needed
--> src\main.rs:43:32
|
43 | let mut parser = delimited(tag("("), tag("abc"), tag(")"));
| ^^^ --- type must be known at this point
| |
| cannot infer type of the type parameter `Input` declared on the function `tag`
|
= note: multiple `impl`s satisfying `_: Compare<&str>` found in the `nom` crate:
- impl<'a, 'b> Compare<&'b str> for &'a [u8];
- impl<'a, 'b> Compare<&'b str> for &'a str;
note: required by a bound in `nom::bytes::complete::tag`
--> C:\Users\bart\.cargo\registry\src\github.com-1ecc6299db9ec823\nom-7.1.3\src\bytes\complete.rs:36:22
|
36 | Input: InputTake + Compare<T>,
| ^^^^^^^^^^ required by this bound in `tag`
help: consider specifying the generic arguments
|
43 | let mut parser = delimited(tag::<&str, Input, Error>("("), tag("abc"), tag(")"));
| ++++++++++++++++++++++
error[E0283]: type annotations needed
--> src\main.rs:43:32
|
43 | let mut parser = delimited(tag("("), tag("abc"), tag(")"));
| ^^^ --- type must be known at this point
| |
| cannot infer type of the type parameter `Input` declared on the function `tag`
|
= note: multiple `impl`s satisfying `_: Compare<&str>` found in the `nom` crate:
- impl<'a, 'b> Compare<&'b str> for &'a [u8];
- impl<'a, 'b> Compare<&'b str> for &'a str;
note: required by a bound in `nom::bytes::complete::tag`
--> C:\Users\bart\.cargo\registry\src\github.com-1ecc6299db9ec823\nom-7.1.3\src\bytes\complete.rs:36:22
|
36 | Input: InputTake + Compare<T>,
| ^^^^^^^^^^ required by this bound in `tag`
help: consider specifying the generic arguments
|
43 | let mut parser = delimited(tag::<&str, Input, Error>("("), tag("abc"), tag(")"));
| ++++++++++++++++++++++
For more information about this error, try `rustc --explain E0283`.
I would appreciate some help about how to use delimited.
nom: 7.1.3 rustc: 1.68.0
This example from documentation:
does not compile:
I would appreciate some help about how to use
delimited
.