pub type DefaultValue = Value;

Aliased Type§

enum DefaultValue {
    Variable(Variable),
    Int {
        value: Float,
        loc: HirNodeLocation,
    },
    Float {
        value: Float,
        loc: HirNodeLocation,
    },
    String {
        value: String,
        loc: HirNodeLocation,
    },
    Boolean {
        value: bool,
        loc: HirNodeLocation,
    },
    Null {
        loc: HirNodeLocation,
    },
    Enum {
        value: Name,
        loc: HirNodeLocation,
    },
    List {
        value: Vec<Value, Global>,
        loc: HirNodeLocation,
    },
    Object {
        value: Vec<(Name, Value), Global>,
        loc: HirNodeLocation,
    },
}

Variants§

§

Variable(Variable)

§

Int

Fields

§value: Float
§

Float

Fields

§value: Float
§

String

Fields

§value: String
§

Boolean

Fields

§value: bool
§

Null

§

Enum

Fields

§value: Name
§

List

Fields

§value: Vec<Value, Global>
§

Object

Fields

§value: Vec<(Name, Value), Global>

Implementations§

source§

impl Value

source

pub fn is_same_value(&self, other: &Value) -> bool

Returns true if other represents the same value as self. This is different from the Eq implementation as it ignores location information.

source

pub fn loc(&self) -> HirNodeLocation

Get current value’s location.

source

pub fn variables(&self) -> Vec<Variable>

source

pub fn kind(&self) -> &str

source

pub fn is_variable(&self) -> bool

Returns true if the value is Variable.

source

pub fn is_null(&self) -> bool

Returns true if the value is Null.

source

pub fn as_i32(&self) -> Option<i32>

Returns an i32 if the value is a number and can be represented as an i32.

source

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

Returns an f64 if the value is a number and can be represented as an f64.

source

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

Returns a str if the value is a string.

source

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

Returns true/false if the value is a boolean.

source

pub fn as_list(&self) -> Option<&Vec<Value>>

Returns the inner list if the value is a List type.

source

pub fn as_object(&self) -> Option<&Vec<(Name, Value)>>

Returns a keys/values list if the value is an input object.

source

pub fn as_variable(&self) -> Option<&Variable>

Returns the hir::Variable if the value is a variable reference.

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

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 Value

source§

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

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

impl Hash for Value

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

source§

fn eq(&self, other: &Value) -> 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 Eq for Value

source§

impl StructuralEq for Value

source§

impl StructuralPartialEq for Value