Type Alias apollo_compiler::database::hir::DefaultValue
source · 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§
Implementations§
source§impl Value
impl Value
sourcepub fn is_same_value(&self, other: &Value) -> bool
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.
sourcepub fn loc(&self) -> HirNodeLocation
pub fn loc(&self) -> HirNodeLocation
Get current value’s location.
pub fn variables(&self) -> Vec<Variable>
pub fn kind(&self) -> &str
sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Returns true if the value is Variable.
sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
Returns an i32 if the value is a number and can be represented as an i32.
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns an f64 if the value is a number and can be represented as an f64.
sourcepub fn as_list(&self) -> Option<&Vec<Value>>
pub fn as_list(&self) -> Option<&Vec<Value>>
Returns the inner list if the value is a List type.
sourcepub fn as_object(&self) -> Option<&Vec<(Name, Value)>>
pub fn as_object(&self) -> Option<&Vec<(Name, Value)>>
Returns a keys/values list if the value is an input object.
sourcepub fn as_variable(&self) -> Option<&Variable>
pub fn as_variable(&self) -> Option<&Variable>
Returns the hir::Variable if the value is a variable reference.