my_parser_striletska 0.1.1

A simple parser, that parses lists of integers from string format
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 1 items with examples
  • Size
  • Source code size: 3.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 242.52 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • KatyaStriletska/my-first-parser
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • KatyaStriletska

My parser

It is a simple parser for education purposes. It allows you to parse numbers in string format.

alt text

Examples

Parsing the correct list:

use my_parser_striletska::list_parser;
fn main() {
    assert_eq!(list_parser::list("[1,1,2,3,5,8]"), Ok(vec![1, 1, 2, 3, 5, 8]));
}

Handling parsing errors:

use my_parser_striletska::list_parser;
fn main() {
    let input = "[1,a]";
    match list_parser::list(input) {
        Ok(parsed) => println!("Parsed list: {:?}", parsed),
        Err(err) => println!("Error: {:?}", err),
    }
}