pub enum Value {
Null {
span: Span,
},
Bool {
value: bool,
span: Span,
},
Integer {
value: i64,
span: Span,
},
Float {
value: f64,
span: Span,
},
String {
value: String,
span: Span,
},
Array {
items: Vec<Value>,
span: Span,
},
Object {
members: Vec<Member>,
span: Span,
},
}Expand description
A parsed value with its exact source span.
Variants§
Implementations§
Source§impl Value
impl Value
pub const fn span(&self) -> Span
Sourcepub const fn kind(&self) -> &'static str
pub const fn kind(&self) -> &'static str
A short name for diagnostics: null, boolean, integer, number,
string, array or object.
pub const fn as_bool(&self) -> Option<bool>
pub const fn as_i64(&self) -> Option<i64>
pub fn as_str(&self) -> Option<&str>
pub fn as_array(&self) -> Option<&[Value]>
pub fn as_object(&self) -> Option<&[Member]>
Sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
The value of an object member, if this is an object that has it.
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Forget for Value
impl Freeze for Value
impl Move for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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