[][src]Struct conjure_object::SafeLong

pub struct SafeLong(_);

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.

Methods

impl SafeLong
[src]

pub fn new(value: i64) -> Result<SafeLong, BoundsError>
[src]

Creates a new SafeLong from an i64.

Returns an error if the value is out of range.

Trait Implementations

impl Default for SafeLong
[src]

impl Clone for SafeLong
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for SafeLong
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Eq for SafeLong
[src]

impl Copy for SafeLong
[src]

impl PartialOrd<SafeLong> for SafeLong
[src]

impl PartialEq<SafeLong> for SafeLong
[src]

impl Display for SafeLong
[src]

impl Debug for SafeLong
[src]

impl Hash for SafeLong
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Deref for SafeLong
[src]

type Target = i64

The resulting type after dereferencing.

impl Serialize for SafeLong
[src]

impl<'de> Deserialize<'de> for SafeLong
[src]

Auto Trait Implementations

impl Send for SafeLong

impl Sync for SafeLong

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]