Enum json5format::Value
source · 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).