Skip to main content

py_parse_int

Function py_parse_int 

Source
pub fn py_parse_int(raw: &str) -> Option<i128>
Expand description

Python int(str) (decimal): strips the Unicode whitespace set (which, unlike str.strip(), excludes U+001C-U+001F — verified empirically, and it matches Rust str::trim), accepts an optional sign, Unicode Nd digits, and single underscores strictly between digits.

Python ints are unbounded; magnitudes beyond i128 SATURATE to i128::MAX (sign applied afterwards). Every consumer only cares about “positive and at least N” thresholds far below the saturation point, so the clamp is unobservable.