Struct sj::Number

source ·
pub struct Number { /* private fields */ }
Expand description

Number

You rarely use this directly, but Json.

Notes

  • Internally, this struct uses an enum to store values of different types (such as i64, f64…). Since different number types cannot be compared directly, PartialEq and PartialOrd are not implemented.
  • Hash is not implemented. Because f32 and f64 don’t implement it.

Trait Implementations§

source§

impl Clone for Number

source§

fn clone(&self) -> Number

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Number

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Number

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<Number> for Json

source§

fn from(n: Number) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Number

source§

fn from(n: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Number

source§

fn from(n: f64) -> Self

Converts to this type from the input type.
source§

impl From<i128> for Number

source§

fn from(n: i128) -> Self

Converts to this type from the input type.
source§

impl From<i16> for Number

source§

fn from(n: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Number

source§

fn from(n: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Number

source§

fn from(n: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Number

source§

fn from(n: i8) -> Self

Converts to this type from the input type.
source§

impl From<isize> for Number

source§

fn from(n: isize) -> Self

Converts to this type from the input type.
source§

impl From<u128> for Number

source§

fn from(n: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Number

source§

fn from(n: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Number

source§

fn from(n: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Number

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Number

source§

fn from(n: u8) -> Self

Converts to this type from the input type.
source§

impl From<usize> for Number

source§

fn from(n: usize) -> Self

Converts to this type from the input type.
source§

impl TryFrom<&Number> for f32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for f64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for i128

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for i16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for i32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for i64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for i8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for isize

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for u128

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for u16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for u32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for u64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for u8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Number> for usize

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: &Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for f32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for f64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i128

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for isize

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u128

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u16

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u32

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u64

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u8

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for usize

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(n: Number) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.