mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
parser/rust: improve word method comments and examples
Signed-off-by: cancaicai <2356672992@qq.com>
This commit is contained in:
parent
017fd006c6
commit
8c9de7c7ab
1 changed files with 5 additions and 1 deletions
|
@ -2714,7 +2714,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Matches an entire `str` and moves the state's position forward if it succeeds.
|
||||
/// Matches an entire `str` at the beginning of the state's bytes and moves the state's position forward if it succeeds.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
@ -2741,6 +2741,10 @@ where
|
|||
/// let (progress, problem) = parser.parse(&arena, State::new("bye, world".as_bytes()), 0).unwrap_err();
|
||||
/// assert_eq!(progress, Progress::NoProgress);
|
||||
/// assert_eq!(problem, Problem::NotFound(Position::zero()));
|
||||
///
|
||||
/// let (progress, problem) = parser.parse(&arena, State::new("world, hello".as_bytes()), 0).unwrap_err();
|
||||
/// assert_eq!(progress, Progress::NoProgress);
|
||||
/// assert_eq!(problem, Problem::NotFound(Position::zero()));
|
||||
/// ```
|
||||
pub fn word<'a, ToError, E>(word: &'static str, to_error: ToError) -> impl Parser<'a, (), E>
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue