Primitive

Enum Primitive 

Source
pub enum Primitive {
    Bool(bool),
    Char(char),
    Number(Number),
    Unit,
}
Expand description

Represents a primitive value

Variants§

§

Bool(bool)

§

Char(char)

§

Number(Number)

§

Unit

Implementations§

Source§

impl Primitive

Source

pub fn is_type(&self, type: PrimitiveType) -> bool

Returns true if this value is of the specified type

Source

pub fn to_type(&self) -> PrimitiveType

Returns the type of this value

Source

pub fn has_same_type(&self, other: &Primitive) -> bool

Returns true if this value and the other value are of the same type

Trait Implementations§

Source§

impl Clone for Primitive

Source§

fn clone(&self) -> Primitive

Returns a duplicate 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 Primitive

Source§

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

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

impl<'a> From<&'a Primitive> for PrimitiveType

Source§

fn from(v: &'a Primitive) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Primitive

Source§

fn from(_: ()) -> Self

Converts to this type from the input type.
Source§

impl From<Primitive> for PrimitiveType

Source§

fn from(v: Primitive) -> Self

Converts to this type from the input type.
Source§

impl From<Primitive> for Value

Source§

fn from(x: Primitive) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Primitive

Source§

fn from(x: bool) -> Self

Converts to this type from the input type.
Source§

impl From<char> for Primitive

Source§

fn from(x: char) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Primitive

Source§

fn from(x: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Primitive

Source§

fn from(x: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Primitive

Source§

fn from(x: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Primitive

Source§

fn from(x: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Primitive

Source§

fn from(x: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Primitive

Source§

fn from(x: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Primitive

Source§

fn from(x: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Primitive

Source§

fn from(x: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Primitive

Source§

fn from(x: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Primitive

Source§

fn from(x: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Primitive

Source§

fn from(x: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Primitive

Source§

fn from(x: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Primitive

Source§

fn from(x: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Primitive

Source§

fn from(x: usize) -> Self

Converts to this type from the input type.
Source§

impl Hash for Primitive

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Primitive

Source§

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

Compares two primitive values of same type for equality, otherwise returns false

1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Primitive

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Compares same variants of same type for ordering, otherwise returns none

1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrimitiveLike for Primitive

Source§

fn into_primitive(self) -> Primitive

Consumes this data, converting it into an abstract Primitive
Source§

fn try_from_primitive(primitive: Primitive) -> Result<Self, Primitive>

Attempts to convert an abstract Primitive into this data, returning the owned value back if unable to convert
Source§

impl TryFrom<Primitive> for ()

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for bool

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for char

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for f32

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for f64

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for i128

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for i16

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for i32

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for i64

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for i8

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for isize

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for u128

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for u16

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for u32

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for u64

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for u8

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Primitive> for usize

Source§

type Error = Primitive

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

fn try_from(x: Primitive) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Primitive

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl Copy for Primitive

Source§

impl Eq for Primitive

Value is considered equal, ignoring the fact that NaN != NaN for floats

Auto Trait Implementations§

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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts reference to Any
Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

converts mutable reference to Any
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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,

Source§

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

Source§

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>,

Source§

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> ValueLike for T
where T: PrimitiveLike,

Source§

fn into_value(self) -> Value

Consumes this data, converting it into an abstract Value
Source§

fn try_from_value(value: Value) -> Result<T, Value>

Attempts to convert an abstract Value into this data, returning the owned value back if unable to convert