Rust-compatible number parsing: str::parse for u32, u64, i32, f32, f64 and from_str_radix(16)
$ sexc add @ajax/mesh-parse- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 04:08v/# 1 version
- drwxr-xr-x-Oct 27 04:08files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 04:08 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-check ^0.1.0
- dependents
- @ajax/mesh-cluster-conf, @ajax/mesh-fleet-doc, @ajax/mesh-fleet-edit, @ajax/mesh-fleet-persist, @ajax/mesh-member-list, @ajax/mesh-place-mode, @ajax/mesh-sched-needs, @ajax/mesh-sched-report, @ajax/mesh-sched-weights
- keywords
- mesh alphaos fleet parse number
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-parse
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-parse 2 3Numbers parsed exactly as Rust's `str::parse` (and `from_str_radix(16)`) accepts them: an optional `+` 4(or `-` for signed), digits only, no whitespace, no overflow; Rust's float grammar (`.5`, `5.`, `1e3`, 5`inf`, `NaN`, no hex floats). C's `strtoul` would accept `" -1"` and wrap it. 6 7## Ported from 8 9`str::parse::<u64 | u32 | u16 | i32 | f32 | f64>()` and `u64::from_str_radix(_, 16)`, as the 10[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) fleet uses them to parse its documents, 11reports and cluster configs. 12 13## Tests 14 15`tests/parse.c`: what Rust accepts and refuses. 16 17## Licence 18 19MIT. See the repository's LICENSE.