pub enum Value {
Bool(bool),
Char(char),
Number(Number),
String(String),
Bytes(Vec<u8>),
Unit,
Option(Option<Box<Value>>),
Seq(Vec<Value>),
Tuple(Vec<Value>),
Map(Map),
Struct(StructFields),
Named {
name: String,
content: NamedContent,
},
}Expand description
A RON value that can represent any valid RON data.
This enum distinguishes between all RON syntactic forms:
Seq: sequences[a, b, c]Tuple: tuples(a, b, c)Map: maps with arbitrary keys{ key: value }Struct: anonymous structs with named fields(x: 1, y: 2)Named: named types (structs/enums) likePoint(x: 1)orOption::Some(1)
Variants§
Bool(bool)
Char(char)
Number(Number)
String(String)
Bytes(Vec<u8>)
Unit
Option(Option<Box<Value>>)
None or Some(value) - special-cased for convenience
Seq(Vec<Value>)
Sequence: [a, b, c]
Tuple(Vec<Value>)
Tuple: (a, b, c) - positional elements
Map(Map)
Map: { key: value } - arbitrary Value keys
Struct(StructFields)
Anonymous struct: (x: 1, y: 2) - named fields, no type name
Named
Named type: Point, Point(1, 2), Point(x: 1), or Type::Variant(...)
The name field stores the full path as-is (e.g., "Type::Variant").
Fields
§
content: NamedContentThe content of the named type
Trait Implementations§
Source§impl<const N: usize> From<&'static [u8; N]> for Value
Special case to allow Value::from(b"byte string")
impl<const N: usize> From<&'static [u8; N]> for Value
Special case to allow Value::from(b"byte string")
Source§impl<T: Into<Value>> FromIterator<T> for Value
impl<T: Into<Value>> FromIterator<T> for Value
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl Ord for Value
impl Ord for Value
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl SerializeRon for Value
impl SerializeRon for Value
Source§fn serialize(&self, fmt: &mut RonFormatter<'_>)
fn serialize(&self, fmt: &mut RonFormatter<'_>)
Serialize this value to the formatter.
Source§impl ToRon for Value
impl ToRon for Value
Source§fn to_ast(&self) -> Result<Expr<'static>>
fn to_ast(&self) -> Result<Expr<'static>>
Convert this value to a RON AST expression. Read more
Source§fn to_ron(&self) -> Result<String>
fn to_ron(&self) -> Result<String>
Convert this value to a pretty-printed RON string (default format).
Source§fn to_ron_with(&self, config: &FormatConfig) -> Result<String>
fn to_ron_with(&self, config: &FormatConfig) -> Result<String>
Convert this value to a RON string with custom formatting. Read more
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.