Module parse_integer_options

Module parse_integer_options 

Source
Available on crate feature parse-integers only.
Expand description

Configuration options for parsing integers.

§Pre-Defined Formats

This contains pre-defined options optimized for either the parsing of large or small numbers.

  • SMALL_NUMBERS: Optimize the parsing of small integers, at a major performance cost to larger values.
  • LARGE_NUMBERS: Optimize the parsing of large integers, at a slight performance cost to smaller values.

§Examples

use lexical_parse_integer::{FromLexicalWithOptions, Options};
use lexical_parse_integer::format::STANDARD;

const OPTIONS: Options = Options::builder()
    .no_multi_digit(true)
    .build_strict();

let value = "1234";
let result = u64::from_lexical_with_options::<STANDARD>(value.as_bytes(), &OPTIONS);
assert_eq!(result, Ok(1234));

Structs§

Options
Options to customize the parsing integers.
OptionsBuilder
Builder for Options.

Constants§

LARGE_NUMBERS
Options optimized for large numbers and long strings.
SMALL_NUMBERS
Options optimized for small numbers.
STANDARD
Standard number format.