pub enum RsonValue {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String),
Char(char),
Array(Vec<RsonValue>),
Map(IndexMap<String, RsonValue>),
Struct {
name: String,
fields: IndexMap<String, RsonValue>,
},
Tuple(Vec<RsonValue>),
Enum {
name: String,
variant: String,
value: Option<Box<RsonValue>>,
},
Option(Option<Box<RsonValue>>),
}Expand description
A value in the RSON format.
This enum represents all possible values that can be expressed in RSON, including both JSON-compatible values and RSON-specific extensions.
Variants§
Null
Null value (maps to None in Option types)
Bool(bool)
Boolean value
Int(i64)
Integer value
Float(f64)
Floating-point value
String(String)
String value
Char(char)
Character value (RSON extension)
Array(Vec<RsonValue>)
Array of values
Map(IndexMap<String, RsonValue>)
Map with string keys (like JSON object)
Struct
Struct with named fields (RSON extension)
Tuple(Vec<RsonValue>)
Tuple with ordered values (RSON extension)
Enum
Enum variant (RSON extension)
Option(Option<Box<RsonValue>>)
Optional value (RSON extension)
Implementations§
Source§impl RsonValue
impl RsonValue
Sourcepub fn value_type(&self) -> RsonType
pub fn value_type(&self) -> RsonType
Get the type of this value.
Sourcepub fn as_map(&self) -> Option<&IndexMap<String, RsonValue>>
pub fn as_map(&self) -> Option<&IndexMap<String, RsonValue>>
Try to get this value as a map reference.
Sourcepub fn get_index(&self, index: usize) -> Option<&RsonValue>
pub fn get_index(&self, index: usize) -> Option<&RsonValue>
Get the value at the given index if this is an array.
Trait Implementations§
impl StructuralPartialEq for RsonValue
Auto Trait Implementations§
impl Freeze for RsonValue
impl RefUnwindSafe for RsonValue
impl Send for RsonValue
impl Sync for RsonValue
impl Unpin for RsonValue
impl UnwindSafe for RsonValue
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