pub enum Value {
String(StringB),
Number(Number),
Boolean(bool),
Array(Array),
Object(Object),
Null,
Undefined,
DateTime(DateTime),
}
Expand description
Represents different data types as an enum.
Converts a Value into a JSON string.
mode - A JsonMode value representing the JSON output format mode.
use json_utils::{Value, JsonMode};
let value = Value::str_to_value("{\"name\":\"John Doe\",\"age\":30,\"is_active\":true}").unwrap();
let json_string = value.to_json(JsonMode::Indented);
println!("{}", json_string);
Returns the YAML representation of the given Value with the specified indentation.
indent - The number of spaces to use for indentation.
let value = Value::from(vec![Value::from(1), Value::from(2), Value::from(3)]);
assert_eq!(value.to_yaml_with_indent(2), " - 1\n - 2\n - 3\n".to_string());
Returns the YAML representation of the given Value.
let value = Value::from(vec![Value::from(1), Value::from(2), Value::from(3)]);
assert_eq!(value.to_yaml(), "- 1\n - 2\n - 3\n".to_string());
Parses a string to a Value.
str - A string slice to parse.
Returns an Error if the string is not parseable.
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used
by ==.
This method tests for !=. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
Converts the given value to a
String.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.