Struct conjure_object::safe_long::SafeLong
source · pub struct SafeLong(_);
Expand description
An i64 limited to a range safely representable in JSON.
JSON does not specify requirements of its numeric type, which can lead to issues interoperating between different JSON libraries and languages. In particular, some implementations (including Javascript) interpret numbers as double precision floating point values. Sufficiently large 64-bit integers are not exactly representable as doubles which can cause bugs as numbers change value as they’re transmitted from place to place.
The SafeLong
type wraps an i64, and avoids these issues by limiting its value to the range that is exactly
representable in a double: values between -253 + 1 and 253 - 1.
Implementations§
Methods from Deref<Target = i64>§
Trait Implementations§
source§impl<'de> Deserialize<'de> for SafeLong
impl<'de> Deserialize<'de> for SafeLong
source§fn deserialize<D>(d: D) -> Result<SafeLong, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<SafeLong, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for SafeLong
impl Ord for SafeLong
source§impl PartialOrd<SafeLong> for SafeLong
impl PartialOrd<SafeLong> for SafeLong
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<SafeLong> for i16
impl TryFrom<SafeLong> for i16
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for i32
impl TryFrom<SafeLong> for i32
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for i8
impl TryFrom<SafeLong> for i8
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for isize
impl TryFrom<SafeLong> for isize
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for u128
impl TryFrom<SafeLong> for u128
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for u16
impl TryFrom<SafeLong> for u16
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for u32
impl TryFrom<SafeLong> for u32
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for u64
impl TryFrom<SafeLong> for u64
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for u8
impl TryFrom<SafeLong> for u8
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<SafeLong> for usize
impl TryFrom<SafeLong> for usize
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<i128> for SafeLong
impl TryFrom<i128> for SafeLong
§type Error = BoundsError
type Error = BoundsError
The type returned in the event of a conversion error.
source§impl TryFrom<i64> for SafeLong
impl TryFrom<i64> for SafeLong
§type Error = BoundsError
type Error = BoundsError
The type returned in the event of a conversion error.
source§impl TryFrom<isize> for SafeLong
impl TryFrom<isize> for SafeLong
§type Error = BoundsError
type Error = BoundsError
The type returned in the event of a conversion error.
source§impl TryFrom<u128> for SafeLong
impl TryFrom<u128> for SafeLong
§type Error = BoundsError
type Error = BoundsError
The type returned in the event of a conversion error.
source§impl TryFrom<u64> for SafeLong
impl TryFrom<u64> for SafeLong
§type Error = BoundsError
type Error = BoundsError
The type returned in the event of a conversion error.
source§impl TryFrom<usize> for SafeLong
impl TryFrom<usize> for SafeLong
§type Error = BoundsError
type Error = BoundsError
The type returned in the event of a conversion error.