Enum compose_spec::Number

source ·
pub enum Number {
    UnsignedInt(u64),
    SignedInt(i64),
    Float(f64),
}
Expand description

A numerical Value.

Variants§

§

UnsignedInt(u64)

A u64 (unsigned integer) value.

Positive integers will parse/deserialize into this.

§

SignedInt(i64)

A i64 (signed integer) value.

Negative integers will parse/deserialize into this.

§

Float(f64)

A f64 (floating point) value.

Implementations§

source§

impl Number

source

pub const fn is_unsigned_int(&self) -> bool

Returns true if the number is an UnsignedInt.

source

pub const fn as_unsigned_int(&self) -> Option<u64>

Returns Some if the number is an UnsignedInt.

source

pub const fn is_signed_int(&self) -> bool

Returns true if the number is a SignedInt.

source

pub const fn as_signed_int(&self) -> Option<i64>

Returns Some if the number is a SignedInt.

source

pub const fn is_float(&self) -> bool

Returns true if the number is a Float.

source

pub const fn as_float(&self) -> Option<f64>

Returns Some if the number is a Float.

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<'de> Deserialize<'de> for Number

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Number

source§

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

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

impl From<Number> for StringOrNumber

source§

fn from(value: Number) -> Self

Converts to this type from the input type.
source§

impl From<Number> for Value

source§

fn from(value: Number) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Number

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Number

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Number

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl FromStr for Number

§

type Err = ParseNumberError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl LowerExp for Number

source§

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

Formats the value using the given formatter.
source§

impl PartialEq for Number

source§

fn eq(&self, other: &Number) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Number

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&str> for Number

§

type Error = ParseNumberError

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

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for f64

§

type Error = TryFromIntError

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

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

Performs the conversion.
source§

impl TryFrom<Number> for i64

§

type Error = TryFromNumberError

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

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

Performs the conversion.
source§

impl TryFrom<Number> for u64

§

type Error = TryFromNumberError

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

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

Performs the conversion.
source§

impl TryFrom<StringOrNumber> for Number

§

type Error = ParseNumberError

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

fn try_from(value: StringOrNumber) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for Number

§

type Error = ParseNumberError

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl UpperExp for Number

source§

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

Formats the value using the given formatter.
source§

impl Copy for Number

source§

impl StructuralPartialEq for Number

Auto Trait Implementations§

§

impl Freeze for Number

§

impl RefUnwindSafe for Number

§

impl Send for Number

§

impl Sync for Number

§

impl Unpin for Number

§

impl UnwindSafe for Number

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 T
where 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 T
where 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 T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.
source§

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