File: readme.rs

package info (click to toggle)
rust-combine 4.6.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 988 kB
  • sloc: sh: 21; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use combine::{
    many1,
    parser::char::{letter, space},
    sep_by, Parser,
};

#[test]
fn readme() {
    main();
}

fn main() {
    let word = many1(letter());

    let mut parser = sep_by(word, space()).map(|mut words: Vec<String>| words.pop());
    let result = parser.parse("Pick up that word!");
    assert_eq!(result, Ok((Some("word".to_string()), "!")));
}