[−][src]Crate hexponent
Hexponent
Hexponent is a hexadecimal literal parser for Rust based on the C11 specification section 6.4.4.2.
use hexponent::Float; let float_repr: Float = "0x3.4".parse().unwrap(); let value = float_repr.into_f32().unwrap(); assert_eq!(value, 3.25);
Features
- No dependencies
- Faster, non-UTF-8 parser
- Precision warnings
Differences from the specification
There are two places where hexponent differs from the C11 specificaiton.
- An exponent is not required. (
0x1.2
is allowed) floating-suffix
is not parsed. (0x1p4l
is not allowed)
Structs
Float | Represents a floating point literal |
Enums
ConversionResult | Indicates the preicsision of a conversion |
ParseError | Error type for parsing hexadecimal literals. |