[−][src]Crate js_int
Crate js_int provides JavaScript-interoperable integer types.
JavaScript does not have native integers. Instead it represents all numeric values with a
single Number type which is represented as an IEEE 754
floating-point value. Rust's i64 and u64 types
can contain values outside the range of what can be represented in a JavaScript Number.
This crate provides the types Int and UInt which wrap i64 and u64, respectively. These
types add bounds checking to ensure the contained value is within the range representable by a
JavaScript Number. They provide useful trait implementations to easily convert from Rust's
primitive integer types.
#![no_std]
The js_int crate does not use Rust's standard library, and is compatible with #![no_std]
programs.
Features
serde: Serialization and deserialization support via serde. Disabled by default.js_intis still#![no_std]-compatible with this feature enabled.std: Enableimpl std::error::Error for TryFromIntError. Enabled by default.
Structs
| Int | An integer limited to the range of integers that can be represented exactly by an f64. |
| TryFromIntError | The error type returned when a checked integral type conversion fails. |
| UInt | An integer limited to the range of positive integers (including zero) that can be represented exactly by an f64. |
Constants
| MAX_SAFE_INT | The largest integer value that can be represented exactly by an f64. |
| MAX_SAFE_UINT | The same as |
| MIN_SAFE_INT | The smallest integer value that can be represented exactly by an f64. |