pub enum Value<'a> {
Variable(VariableValue<'a>),
Int(IntValue<'a>),
Float(FloatValue<'a>),
String(StringValue<'a>),
Boolean(BooleanValue<'a>),
Null(NullValue<'a>),
Enum(EnumValue<'a>),
List(List<'a>),
Object(Object<'a>),
}
Variants§
Variable(VariableValue<'a>)
Int(IntValue<'a>)
Float(FloatValue<'a>)
String(StringValue<'a>)
Boolean(BooleanValue<'a>)
Null(NullValue<'a>)
Enum(EnumValue<'a>)
List(List<'a>)
Object(Object<'a>)
Implementations§
Source§impl<'a> Value<'a>
impl<'a> Value<'a>
pub fn span(&self) -> Span
Sourcepub fn variables_used(&self) -> impl Iterator<Item = &'a str> + '_
pub fn variables_used(&self) -> impl Iterator<Item = &'a str> + '_
Returns an iterator over all the variables that appear somewhere in this Value.
Note that this is not deduplicated - if a variable appears more than once in the value it’ll appear more than once in this iterator.
Source§impl<'a> Value<'a>
impl<'a> Value<'a>
pub fn is_variable(&self) -> bool
pub fn as_variable(&self) -> Option<&'a str>
pub fn is_int(&self) -> bool
pub fn as_i32(&self) -> Option<i32>
pub fn is_float(&self) -> bool
pub fn as_f64(&self) -> Option<f64>
pub fn is_string(&self) -> bool
pub fn as_str(&self) -> Option<&'a str>
pub fn is_boolean(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn is_null(&self) -> bool
pub fn as_null(&self) -> Option<()>
pub fn is_enum(&self) -> bool
pub fn as_enum_value(&self) -> Option<&'a str>
pub fn is_list(&self) -> bool
pub fn as_list(&self) -> Option<List<'a>>
pub fn as_items(&self) -> Option<Iter<'a, Value<'a>>>
pub fn is_object(&self) -> bool
pub fn as_object(&self) -> Option<Object<'a>>
pub fn as_fields(&self) -> Option<Iter<'a, ObjectField<'a>>>
Trait Implementations§
Source§impl<'a> From<ConstValue<'a>> for Value<'a>
impl<'a> From<ConstValue<'a>> for Value<'a>
Source§fn from(value: ConstValue<'a>) -> Self
fn from(value: ConstValue<'a>) -> Self
Converts to this type from the input type.
Source§impl PartialEq<ConstValue<'_>> for Value<'_>
impl PartialEq<ConstValue<'_>> for Value<'_>
Source§impl PartialEq<Value<'_>> for ConstValue<'_>
impl PartialEq<Value<'_>> for ConstValue<'_>
Source§impl<'a> TryFrom<Value<'a>> for ConstValue<'a>
impl<'a> TryFrom<Value<'a>> for ConstValue<'a>
impl<'a> Copy for Value<'a>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more