pub enum Value {
Primitive {
val: Primitive,
comments: Comments,
},
Array {
val: Array,
comments: Comments,
},
Object {
val: Object,
comments: Comments,
},
}
Expand description
Represents the possible data types in a JSON5 object. Each variant has a field representing a
specialized struct representing the value’s data, and a field for comments (possibly including a
line comment and comments appearing immediately before the value). For Object
and Array
,
comments appearing at the end of the the structure are encapsulated inside the appropriate
specialized struct.
Variants§
Primitive
Represents a non-recursive data type (string, bool, number, or “null”) and its associated comments.
Fields
Array
Represents a JSON5 array and its associated comments.
Fields
Object
Represents a JSON5 object and its associated comments.
Implementations§
Source§impl Value
impl Value
Sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Returns true
for a Primitive
variant.
Sourcepub fn comments(&self) -> &Comments
pub fn comments(&self) -> &Comments
Retrieves an immutable reference to the comments
attribute of any variant.
Sourcepub fn comments_mut(&mut self) -> &mut Comments
pub fn comments_mut(&mut self) -> &mut Comments
Returns a mutable reference to the comments
attribute of any variant.
Sourcepub fn has_comments(&mut self) -> bool
pub fn has_comments(&mut self) -> bool
Returns true if this value has any block, line, or end-of-line comment(s).