Module aoc_parse::prelude

source ·
Expand description

A giant sack of toys and goodies to import along with parser!.

The parser!() macro will work fine without this, so you can explicitly import the names you want to use instead of doing use aoc_parse::{parser, prelude::*};.

This includes some constants that have the same name as a built-in Rust type: i32, usize, bool, and so on. There’s no conflict because Rust types and constants live in separate namespaces.

Constants

Matches any alphabetic or numeric character (see char::is_alphanumeric). Returns a char.
Matches any alphabetic character (see char::is_alphabetic). Returns a char.
Matches any Unicode character. Returns a char.
Parse a BigInt (using its FromStr implementation in the num-bigint crate, except that underscores between digits are not accepted).
Parse a BigInt written in base 2 (using its Num impl from the num-bigint crate, except that underscores between digits are not accepted).
Parse a BigInt written in base 16 (using its Num impl from the num-bigint crate, except that underscores between digits are not accepted).
Parse a BigUint (using its FromStr implementation in the num-bigint crate, except that underscores between digits are not accepted and a leading + sign is not accepted).
Parse a BigUint written in base 2 (using its Num impl from the num-bigint crate, except that underscores between digits are not accepted and a leading + sign is not accepted).
Parse a BigUint written in base 16 (using its Num impl from the num-bigint crate, except that underscores between digits are not accepted and a leading + sign is not accepted).
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Matches any ASCII decimal digit '0'-'9' and converts it to its integer value 0-9.
Matches a binary digit '0' or '1', and converts it to its integer value 0 or 1.
Matches a hexadecimal digit '0'-'9', 'a'-'f', or 'A'-'F', and converts it to its integer value 0-15.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Matches any lowercase letter (see char::is_lowercase). Returns a char.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.
Matches any uppercase letter (see char::is_uppercase). Returns a char.
Parse a value of a primitive type (using its FromStr implementation in the Rust standard library).
Parse an integer written in base 2, using the from_str_radix static method from the Rust standard library.
Parse an integer written in base 16, using the from_str_radix static method from the Rust standard library.

Traits

Trait implemented by all parsers.

Functions

Make a parser that matches any single character in options and produces the index of that character in the list, so that char_of("ABCD") produces a number in 0..4.
line(pattern) matches a single line of text that matches pattern, and the newline at the end of the line.
lines(pattern) matches any number of lines of text matching pattern. Each line must be terminated by a newline, '\n'.
repeat_sep(pattern, separator) matches the given pattern any number of times, separated by the separator. For example, parser!(repeat_sep(i32, ",")) matches a list of comma-separated integers.
section(pattern) matches zero or more nonblank lines, followed by either a blank line or the end of input. The nonblank lines must match pattern.
sections(pattern) matches any number of sections matching pattern. Equivalent to section(pattern)*.
Parse using parser, but instead of converting the matched text to a Rust value, simply return it as a String.