Enum tau_engine::Value

source ·
pub enum Value<'a> {
    Null,
    Bool(bool),
    Float(f64),
    Int(i64),
    UInt(u64),
    String(Cow<'a, str>),
    Array(&'a dyn Array),
    Object(&'a dyn Object),
}
Expand description

A dynamic data type that the solver can reason on.

Variants§

§

Null

Represents an empty type.

§

Bool(bool)

Represents a boolean.

§

Float(f64)

Represents a float.

§

Int(i64)

Represents an integer.

§

UInt(u64)

Represents an unsigned integer.

§

String(Cow<'a, str>)

Represents a string.

§

Array(&'a dyn Array)

Represents an array.

§

Object(&'a dyn Object)

Represents an object.

Implementations§

source§

impl<'a> Value<'a>

source

pub fn is_array(&self) -> bool

Returns true if the Value is an Array.

source

pub fn is_bool(&self) -> bool

Returns true if the Value is a Bool.

source

pub fn is_f64(&self) -> bool

Returns true if the Value is a Float.

source

pub fn is_i64(&self) -> bool

Returns true if the Value is an Int.

source

pub fn is_null(&self) -> bool

Returns true if the Value is a Null.

source

pub fn is_object(&self) -> bool

Returns true if the Value is an Object.

source

pub fn is_string(&self) -> bool

Returns true if the Value is a String.

source

pub fn is_u64(&self) -> bool

Returns true if the Value is a UInt.

source

pub fn as_array(&self) -> Option<&dyn Array>

Return the associated array if the Value is an Array.

source

pub fn as_bool(&self) -> Option<bool>

Return the associated boolean if the Value is a Bool.

source

pub fn as_f64(&self) -> Option<f64>

Return the associated f64 if the Value is a Float.

source

pub fn as_i64(&self) -> Option<i64>

Return the associated i64 if the Value is a Int.

source

pub fn as_null(&self) -> Option<()>

Return the associated () if the Value is a Null.

source

pub fn as_object(&self) -> Option<&dyn Object>

Return the associated object if the Value is an Object.

source

pub fn as_str(&self) -> Option<&str>

Return the associated str if the Value is a String.

source

pub fn as_u64(&self) -> Option<u64>

Return the associated u64 if the Value is a UInt.

source

pub fn to_i64(&self) -> Option<i64>

Returns the Value as an i64 if possible.

Currently supports: Int & UInt.

source

pub fn to_string(&self) -> Option<String>

Returns the Value as a String if possible.

Currently supports: Bool, Float, Int, String & UInt.

Trait Implementations§

source§

impl<'a> Clone for Value<'a>

source§

fn clone(&self) -> Value<'a>

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

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Value<'a>

§

impl<'a> !Send for Value<'a>

§

impl<'a> !Sync for Value<'a>

§

impl<'a> Unpin for Value<'a>

§

impl<'a> !UnwindSafe for Value<'a>

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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 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, U> TryFrom<U> for Twhere 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 Twhere 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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more