Enum 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 Value<'_>

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 duplicate 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> Freeze for Value<'a>

§

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