Enum json_with_comments::value::JsoncValue
source · pub enum JsoncValue<I, F> {
Object(MapImpl<String, JsoncValue<I, F>>),
Array(Vec<JsoncValue<I, F>>),
Bool(bool),
Null,
String(String),
Number(Number<I, F>),
}
Expand description
Represents any valid JSON with comments value.
§Examples
see crate
document also.
use json_with_comments::{jsonc_generics, value::JsoncValue};
let mut value: JsoncValue<u32, f32> = jsonc_generics!({
"name": "json-with-comments",
"keywords": [
"JSON with comments",
"JSONC",
"trailing comma",
],
});
// index access
assert_eq!(value["name"], JsoncValue::String("json-with-comments".to_string()));
assert_eq!(
value["keywords"].get(..=1),
Some(
&[JsoncValue::String("JSON with comments".to_string()), JsoncValue::String("JSONC".to_string())][..]
)
);
// mutable access
value["name"] = "json_with_comments".into();
if let Some(JsoncValue::String(jsonc)) = value["keywords"].get_mut(1) {
*jsonc = jsonc.to_lowercase();
}
assert_eq!(value, jsonc_generics!({
"name": "json_with_comments",
"keywords": [
"JSON with comments",
"jsonc",
"trailing comma",
],
}));
// as rust value
let v = value["keywords"].as_vec().unwrap();
let mut iter = v.iter();
assert_eq!(iter.next().unwrap().as_str().unwrap(), "JSON with comments");
assert_eq!(iter.next().unwrap().as_str().unwrap(), "jsonc");
assert_eq!(iter.next().unwrap().as_str().unwrap(), "trailing comma");
assert_eq!(iter.next(), None);
Variants§
Object(MapImpl<String, JsoncValue<I, F>>)
Represents any valid JSON with comments object.
Default implementation is HashMap
. If preserve_order
feature is enabled, that will be IndexMap
.
let v = json_with_comments::jsonc!({"key": "value"});
Array(Vec<JsoncValue<I, F>>)
Represents any valid JSON with comments array.
let v = json_with_comments::jsonc!([1, 2, 3]);
Bool(bool)
Represents any valid JSON with comments boolean.
let v = json_with_comments::jsonc!(true);
Null
Represents any valid JSON with comments null.
let v = json_with_comments::jsonc!(null);
String(String)
Represents any valid JSON with comments string.
let v = json_with_comments::jsonc!("string");
Number(Number<I, F>)
Represents any valid JSON with comments number, whether integer or float.
let v = json_with_comments::jsonc!(123.45);
Implementations§
source§impl<'de, I, F> JsoncValue<I, F>where
I: ToPrimitive,
F: ToPrimitive,
impl<'de, I, F> JsoncValue<I, F>where
I: ToPrimitive,
F: ToPrimitive,
sourcepub fn into_deserialize<D>(&'de self) -> Result<D>where
D: Deserialize<'de>,
pub fn into_deserialize<D>(&'de self) -> Result<D>where
D: Deserialize<'de>,
Deserialize a JsoncValue
as type D
.
§Examples
use serde::Deserialize;
#[derive(Deserialize)]
struct Person<'a> {
name: &'a str,
age: Option<u32>,
}
let target = json_with_comments::jsonc!({"name": "John", "age": 30});
let person: Person = target.into_deserialize().unwrap();
assert!(matches!(person, Person { name: "John", age: Some(30) }));
source§impl<I, F> JsoncValue<I, F>
impl<I, F> JsoncValue<I, F>
sourcepub fn get<In: JsoncIndex<Self>>(
&self,
index: In
) -> Option<&<In::Indexer as JsoncIndexer<In, JsoncValue<I, F>>>::Output>
pub fn get<In: JsoncIndex<Self>>( &self, index: In ) -> Option<&<In::Indexer as JsoncIndexer<In, JsoncValue<I, F>>>::Output>
Returns a reference to the value at the given index.
- if the value is an array, returns the element at the given index, or
None
if the index is out of bounds. - if the value is an object, returns the value associated with the given key, or
None
if the key is not found. - if the value is neither an array nor an object, returns
None
.
§Examples
use json_with_comments::jsonc;
let value = jsonc!({
"array": [1, 2, 3],
"object": {
"key": "value",
},
});
assert_eq!(value["array"].get(0), Some(&1.into()));
assert_eq!(value["array"].get(1..), Some(&[2.into(), 3.into()][..]));
assert_eq!(value["array"].get(1000), None);
assert_eq!(value["object"].get("key"), Some(&"value".into()));
assert_eq!(value["object"].get("nonexistent"), None);
assert_eq!(value["array"][1].get(0), None);
assert_eq!(value["object"]["key"].get(""), None);
sourcepub fn get_mut<In: JsoncIndex<Self>>(
&mut self,
index: In
) -> Option<&mut <In::Indexer as JsoncIndexer<In, JsoncValue<I, F>>>::Output>
pub fn get_mut<In: JsoncIndex<Self>>( &mut self, index: In ) -> Option<&mut <In::Indexer as JsoncIndexer<In, JsoncValue<I, F>>>::Output>
Returns a mutable reference to the value at the given index (see Self::get
).
§Examples
use json_with_comments::{jsonc, Value, value::number::Number};
let mut value = jsonc!({
"array": [1, 2, 3],
"object": {
"key": "value",
},
});
if let Some(Value::Number(Number::Integer(i))) = value["array"].get_mut(2) {
assert_eq!(i, &3);
*i = *i * *i;
assert_eq!(i, &9);
}
if let Some(v) = value["object"].get_mut("key") {
assert_eq!(v, &Value::String("value".to_string()));
*v = ().into();
assert_eq!(v, &Value::Null);
}
assert_eq!(value, jsonc!({
"array": [1, 2, 9],
"object": {
"key": null,
},
}));
source§impl<I, F> JsoncValue<I, F>
impl<I, F> JsoncValue<I, F>
sourcepub fn is_object(&self) -> bool
pub fn is_object(&self) -> bool
Returns true if the Value
is an Object
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(jsonc!({"key": "value"}).is_object());
assert!(!jsonc!([1, 2, 3]).is_object());
assert!(!jsonc!(true).is_object());
assert!(!jsonc!(null).is_object());
assert!(!jsonc!("string").is_object());
assert!(!jsonc!(123).is_object());
assert!(!jsonc!(123.45).is_object());
sourcepub fn as_map(&self) -> Option<&MapImpl<String, Self>>
pub fn as_map(&self) -> Option<&MapImpl<String, Self>>
If the Value
is an Object
, returns the associated Map
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_map(), Some(&json_with_comments::value::MapImpl::from([("key".to_string(), "value".into())])));
assert_eq!(jsonc!([1, 2, 3]).as_map(), None);
assert_eq!(jsonc!(true).as_map(), None);
assert_eq!(jsonc!(null).as_map(), None);
assert_eq!(jsonc!("string").as_map(), None);
assert_eq!(jsonc!(123).as_map(), None);
assert_eq!(jsonc!(123.45).as_map(), None);
sourcepub fn as_map_mut(&mut self) -> Option<&mut MapImpl<String, Self>>
pub fn as_map_mut(&mut self) -> Option<&mut MapImpl<String, Self>>
If the Value
is an Object
, returns the associated mutable Map
reference. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
let mut object = jsonc!({"key": "value"});
let mut map = object.as_map_mut().unwrap();
map.insert("new_key".to_string(), "new_value".into());
assert_eq!(object, jsonc!({"key": "value", "new_key": "new_value"}));
sourcepub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Returns true if the Value
is an Array
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_array());
assert!(jsonc!([1, 2, 3]).is_array());
assert!(!jsonc!(true).is_array());
assert!(!jsonc!(null).is_array());
assert!(!jsonc!("string").is_array());
assert!(!jsonc!(123).is_array());
assert!(!jsonc!(123.45).is_array());
sourcepub fn as_vec(&self) -> Option<&Vec<Self>>
pub fn as_vec(&self) -> Option<&Vec<Self>>
If the Value
is an Array
, returns the associated Vec
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_vec(), None);
assert_eq!(jsonc!([1, 2, 3]).as_vec(), Some(&vec![1.into(), 2.into(), 3.into()]));
assert_eq!(jsonc!(true).as_vec(), None);
assert_eq!(jsonc!(null).as_vec(), None);
assert_eq!(jsonc!("string").as_vec(), None);
assert_eq!(jsonc!(123).as_vec(), None);
assert_eq!(jsonc!(123.45).as_vec(), None);
sourcepub fn as_vec_mut(&mut self) -> Option<&mut Vec<Self>>
pub fn as_vec_mut(&mut self) -> Option<&mut Vec<Self>>
If the Value
is an Array
, returns the associated mutable Vec
reference. Returns None otherwise.
§Examples
use json_with_comments::{jsonc, to_string};
let mut array = jsonc!([1, 2, 3]);
let mut vec = array.as_vec_mut().unwrap();
vec.iter_mut().for_each(|v| *v = to_string(&v).unwrap().into());
assert_eq!(array, jsonc!(["1", "2", "3"]));
sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if the Value
is an Boolean
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_boolean());
assert!(!jsonc!([1, 2, 3]).is_boolean());
assert!(jsonc!(true).is_boolean());
assert!(!jsonc!(null).is_boolean());
assert!(!jsonc!("string").is_boolean());
assert!(!jsonc!(123).is_boolean());
assert!(!jsonc!(123.45).is_boolean());
sourcepub fn as_bool(&self) -> Option<&bool>
pub fn as_bool(&self) -> Option<&bool>
If the Value
is an Boolean
, returns the associated bool
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_bool(), None);
assert_eq!(jsonc!([1, 2, 3]).as_bool(), None);
assert_eq!(jsonc!(true).as_bool(), Some(&true));
assert_eq!(jsonc!(null).as_bool(), None);
assert_eq!(jsonc!("string").as_bool(), None);
assert_eq!(jsonc!(123).as_bool(), None);
assert_eq!(jsonc!(123.45).as_bool(), None);
sourcepub fn as_bool_mut(&mut self) -> Option<&mut bool>
pub fn as_bool_mut(&mut self) -> Option<&mut bool>
If the Value
is an Boolean
, returns the associated mutable bool
reference. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
let mut boolean = jsonc!(true);
let mut bool = boolean.as_bool_mut().unwrap();
*bool = false;
assert_eq!(boolean, jsonc!(false));
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if the Value
is an Null
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_null());
assert!(!jsonc!([1, 2, 3]).is_null());
assert!(!jsonc!(true).is_null());
assert!(jsonc!(null).is_null());
assert!(!jsonc!("string").is_null());
assert!(!jsonc!(123).is_null());
assert!(!jsonc!(123.45).is_null());
sourcepub fn as_unit(&self) -> Option<()>
pub fn as_unit(&self) -> Option<()>
If the Value
is an Null
, returns the associated ()
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_unit(), None);
assert_eq!(jsonc!([1, 2, 3]).as_unit(), None);
assert_eq!(jsonc!(true).as_unit(), None);
assert_eq!(jsonc!(null).as_unit(), Some(()));
assert_eq!(jsonc!("string").as_unit(), None);
assert_eq!(jsonc!(123).as_unit(), None);
assert_eq!(jsonc!(123.45).as_unit(), None);
sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if the Value
is an String
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_string());
assert!(!jsonc!([1, 2, 3]).is_string());
assert!(!jsonc!(true).is_string());
assert!(!jsonc!(null).is_string());
assert!(jsonc!("string").is_string());
assert!(!jsonc!(123).is_string());
assert!(!jsonc!(123.45).is_string());
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
If the Value
is an String
, returns the associated str
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_str(), None);
assert_eq!(jsonc!([1, 2, 3]).as_str(), None);
assert_eq!(jsonc!(true).as_str(), None);
assert_eq!(jsonc!(null).as_str(), None);
assert_eq!(jsonc!("string").as_str(), Some("string"));
assert_eq!(jsonc!(123).as_str(), None);
assert_eq!(jsonc!(123.45).as_str(), None);
sourcepub fn as_str_mut(&mut self) -> Option<&mut str>
pub fn as_str_mut(&mut self) -> Option<&mut str>
If the Value
is an String
, returns the associated mutable str
reference. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
let mut boolean = jsonc!(true);
let mut bool = boolean.as_bool_mut().unwrap();
*bool = false;
assert_eq!(boolean, jsonc!(false));
sourcepub fn is_number(&self) -> bool
pub fn is_number(&self) -> bool
Returns true if the Value
is an Number
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_number());
assert!(!jsonc!([1, 2, 3]).is_number());
assert!(!jsonc!(true).is_number());
assert!(!jsonc!(null).is_number());
assert!(!jsonc!("string").is_number());
assert!(jsonc!(123).is_number());
assert!(jsonc!(123.45).is_number());
sourcepub fn as_number(&self) -> Option<&Number<I, F>>
pub fn as_number(&self) -> Option<&Number<I, F>>
If the Value
is an Number
, returns the associated Number
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_number(), None);
assert_eq!(jsonc!([1, 2, 3]).as_number(), None);
assert_eq!(jsonc!(true).as_number(), None);
assert_eq!(jsonc!(null).as_number(), None);
assert_eq!(jsonc!("string").as_number(), None);
assert_eq!(jsonc!(123).as_number(), Some(&json_with_comments::value::number::Number::Integer(123)));
assert_eq!(jsonc!(123.45).as_number(), Some(&json_with_comments::value::number::Number::Float(123.45)));
sourcepub fn as_number_mut(&mut self) -> Option<&mut Number<I, F>>
pub fn as_number_mut(&mut self) -> Option<&mut Number<I, F>>
If the Value
is an Number
, returns the associated mutable Number
reference. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
let mut num = jsonc!(123);
let mut number = num.as_number_mut().unwrap();
*number = json_with_comments::value::number::Number::Float(123.45);
assert_eq!(num, jsonc!(123.45));
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if the Value
is an Integer
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_integer());
assert!(!jsonc!([1, 2, 3]).is_integer());
assert!(!jsonc!(true).is_integer());
assert!(!jsonc!(null).is_integer());
assert!(!jsonc!("string").is_integer());
assert!(jsonc!(123).is_integer());
assert!(!jsonc!(123.45).is_integer());
sourcepub fn as_integer(&self) -> Option<&I>
pub fn as_integer(&self) -> Option<&I>
If the Value
is an Integer
, returns the associated I
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_integer(), None);
assert_eq!(jsonc!([1, 2, 3]).as_integer(), None);
assert_eq!(jsonc!(true).as_integer(), None);
assert_eq!(jsonc!(null).as_integer(), None);
assert_eq!(jsonc!("string").as_integer(), None);
assert_eq!(jsonc!(123).as_integer(), Some(&123i64));
assert_eq!(jsonc!(123.45).as_integer(), None);
sourcepub fn as_integer_mut(&mut self) -> Option<&mut I>
pub fn as_integer_mut(&mut self) -> Option<&mut I>
If the Value
is an Integer
, returns the associated mutable I
reference. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
let mut integer = jsonc!(123);
let mut i = integer.as_integer_mut().unwrap();
*i = *i * *i;
assert_eq!(integer, jsonc!(15129));
sourcepub fn is_float(&self) -> bool
pub fn is_float(&self) -> bool
Returns true if the Value
is an Float
. Returns false otherwise.
§Examples
use json_with_comments::jsonc;
assert!(!jsonc!({"key": "value"}).is_float());
assert!(!jsonc!([1, 2, 3]).is_float());
assert!(!jsonc!(true).is_float());
assert!(!jsonc!(null).is_float());
assert!(!jsonc!("string").is_float());
assert!(!jsonc!(123).is_float());
assert!(jsonc!(123.45).is_float());
sourcepub fn as_float(&self) -> Option<&F>
pub fn as_float(&self) -> Option<&F>
If the Value
is an Float
, returns the associated F
. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).as_float(), None);
assert_eq!(jsonc!([1, 2, 3]).as_float(), None);
assert_eq!(jsonc!(true).as_float(), None);
assert_eq!(jsonc!(null).as_float(), None);
assert_eq!(jsonc!("string").as_float(), None);
assert_eq!(jsonc!(123).as_float(), None);
assert_eq!(jsonc!(123.45).as_float(), Some(&123.45f64));
sourcepub fn as_float_mut(&mut self) -> Option<&mut F>
pub fn as_float_mut(&mut self) -> Option<&mut F>
If the Value
is an Float
, returns the associated mutable F
reference. Returns None otherwise.
§Examples
use json_with_comments::jsonc;
let mut float = jsonc!(123.45);
let mut f = float.as_float_mut().unwrap();
*f = *f + *f;
assert_eq!(float, jsonc!(246.9));
source§impl<I, F> JsoncValue<I, F>where
I: FromPrimitive,
F: FromPrimitive,
impl<I, F> JsoncValue<I, F>where
I: FromPrimitive,
F: FromPrimitive,
sourcepub fn from_serialize<S>(value: S) -> Result<Self>where
S: Serialize,
pub fn from_serialize<S>(value: S) -> Result<Self>where
S: Serialize,
Serialize a JsoncValue
as type S
.
§Examples
use serde::Serialize;
#[derive(Serialize)]
struct Person<'a> {
name: &'a str,
age: Option<u32>,
}
let target = Person { name: "John", age: Some(30) };
let person = json_with_comments::Value::from_serialize(target).unwrap();
assert_eq!(person, json_with_comments::jsonc!({"name": "John", "age": 30}));
source§impl<I, F> JsoncValue<I, F>
impl<I, F> JsoncValue<I, F>
sourcepub fn query(&self, query: &str) -> Option<&JsoncValue<I, F>>
pub fn query(&self, query: &str) -> Option<&JsoncValue<I, F>>
TODO doc
sourcepub fn take(&mut self) -> Self
pub fn take(&mut self) -> Self
Replaces value with the default value Null
, returning the previous value.
- If you want to replace the values of two variables, see
Self::swap
. - If you want to replace with a passed value instead of the default value, see
Self::replace
.
§Examples
use json_with_comments::jsonc;
let mut value = jsonc!({
"name": "json-with-comments",
"keywords": [
"JSON with comments",
"JSONC",
"trailing comma",
],
});
let name = value["name"].take();
assert_eq!(name, "json-with-comments".into());
assert_eq!(value, jsonc!({
"name": null,
"keywords": [
"JSON with comments",
"JSONC",
"trailing comma"
]
}));
sourcepub fn swap(&mut self, other: &mut Self)
pub fn swap(&mut self, other: &mut Self)
Swaps self
value and other
value.
- If you want to swap with a default or dummy value, see
Self::take
. - If you want to replace with a passed value instead of the default value, see
Self::replace
.
§Examples
use json_with_comments::jsonc;
let mut value = jsonc!({
"name": "json-with-comments",
"keywords": [
"JSON with comments",
"JSONC",
"trailing comma",
],
});
let mut lower = "jsonc".into();
let name = value["keywords"][1].swap(&mut lower);
assert_eq!(lower, "JSONC".into());
assert_eq!(value, jsonc!({
"name": "json-with-comments",
"keywords": [
"JSON with comments",
"jsonc",
"trailing comma"
]
}));
sourcepub fn replace(&mut self, other: Self) -> Self
pub fn replace(&mut self, other: Self) -> Self
Moves other
value into self
value, returning the previous self
value.
- If you want to swap with a default or dummy value, see
Self::take
. - If you want to replace the values of two variables, see
Self::swap
.
§Examples
use json_with_comments::jsonc;
let mut value = jsonc!({
"name": "json-with-comments",
"keywords": [
"JSON with comments",
"JSONC",
"trailing comma",
],
});
let upper = "JSON WITH COMMENTS".into();
let original = value["keywords"][0].replace(upper);
assert_eq!(original, "JSON with comments".into());
assert_eq!(value, jsonc!({
"name": "json-with-comments",
"keywords": [
"JSON WITH COMMENTS",
"JSONC",
"trailing comma"
]
}));
sourcepub fn value_type(&self) -> String
pub fn value_type(&self) -> String
Get the value type representation of JsoncValue
.
Main use case is for error reporting.
§Examples
use json_with_comments::jsonc;
assert_eq!(jsonc!({"key": "value"}).value_type(), "Object");
assert_eq!(jsonc!([1, 2, 3]).value_type(), "Array");
assert_eq!(jsonc!(true).value_type(), "Boolean");
assert_eq!(jsonc!(null).value_type(), "Null");
assert_eq!(jsonc!("string").value_type(), "String");
assert_eq!(jsonc!(123).value_type(), "Number");
assert_eq!(jsonc!(123.45).value_type(), "Number");
Trait Implementations§
source§impl<I: Clone, F: Clone> Clone for JsoncValue<I, F>
impl<I: Clone, F: Clone> Clone for JsoncValue<I, F>
source§fn clone(&self) -> JsoncValue<I, F>
fn clone(&self) -> JsoncValue<I, F>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<I, F> Default for JsoncValue<I, F>
impl<I, F> Default for JsoncValue<I, F>
source§impl<'de, I: FromPrimitive, F: FromPrimitive> Deserialize<'de> for JsoncValue<I, F>
impl<'de, I: FromPrimitive, F: FromPrimitive> Deserialize<'de> for JsoncValue<I, F>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl<I, F> From<&str> for JsoncValue<I, F>
impl<I, F> From<&str> for JsoncValue<I, F>
source§impl<I, F> From<()> for JsoncValue<I, F>
impl<I, F> From<()> for JsoncValue<I, F>
source§impl<I, F> From<HashMap<String, JsoncValue<I, F>>> for JsoncValue<I, F>
impl<I, F> From<HashMap<String, JsoncValue<I, F>>> for JsoncValue<I, F>
source§impl<I, F> From<Number<I, F>> for JsoncValue<I, F>
impl<I, F> From<Number<I, F>> for JsoncValue<I, F>
source§impl<I, F> From<String> for JsoncValue<I, F>
impl<I, F> From<String> for JsoncValue<I, F>
source§impl<I, F> From<Vec<JsoncValue<I, F>>> for JsoncValue<I, F>
impl<I, F> From<Vec<JsoncValue<I, F>>> for JsoncValue<I, F>
source§fn from(value: Vec<JsoncValue<I, F>>) -> Self
fn from(value: Vec<JsoncValue<I, F>>) -> Self
source§impl<I, F> From<bool> for JsoncValue<I, F>
impl<I, F> From<bool> for JsoncValue<I, F>
source§impl<I, F> FromIterator<(String, JsoncValue<I, F>)> for JsoncValue<I, F>
impl<I, F> FromIterator<(String, JsoncValue<I, F>)> for JsoncValue<I, F>
source§fn from_iter<T: IntoIterator<Item = (String, JsoncValue<I, F>)>>(
iter: T
) -> Self
fn from_iter<T: IntoIterator<Item = (String, JsoncValue<I, F>)>>( iter: T ) -> Self
source§impl<I, F> FromIterator<JsoncValue<I, F>> for JsoncValue<I, F>
impl<I, F> FromIterator<JsoncValue<I, F>> for JsoncValue<I, F>
source§fn from_iter<T: IntoIterator<Item = JsoncValue<I, F>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = JsoncValue<I, F>>>(iter: T) -> Self
source§impl<I: FromPrimitive, F: FromPrimitive> FromStr for JsoncValue<I, F>
impl<I: FromPrimitive, F: FromPrimitive> FromStr for JsoncValue<I, F>
source§impl<I, F, In: JsoncIndex<JsoncValue<I, F>>> Index<In> for JsoncValue<I, F>
impl<I, F, In: JsoncIndex<JsoncValue<I, F>>> Index<In> for JsoncValue<I, F>
§type Output = <<In as JsoncIndex<JsoncValue<I, F>>>::Indexer as JsoncIndexer<In, JsoncValue<I, F>>>::Output
type Output = <<In as JsoncIndex<JsoncValue<I, F>>>::Indexer as JsoncIndexer<In, JsoncValue<I, F>>>::Output
source§impl<I, F, In: JsoncIndex<JsoncValue<I, F>>> IndexMut<In> for JsoncValue<I, F>
impl<I, F, In: JsoncIndex<JsoncValue<I, F>>> IndexMut<In> for JsoncValue<I, F>
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for &str
impl<I, F> JsoncIndex<JsoncValue<I, F>> for &str
type Indexer = StringIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for Range<usize>
impl<I, F> JsoncIndex<JsoncValue<I, F>> for Range<usize>
type Indexer = SliceIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeFrom<usize>
impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeFrom<usize>
type Indexer = SliceIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeFull
impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeFull
type Indexer = SliceIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeInclusive<usize>
impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeInclusive<usize>
type Indexer = SliceIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeTo<usize>
impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeTo<usize>
type Indexer = SliceIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeToInclusive<usize>
impl<I, F> JsoncIndex<JsoncValue<I, F>> for RangeToInclusive<usize>
type Indexer = SliceIndexer
source§impl<I, F> JsoncIndex<JsoncValue<I, F>> for usize
impl<I, F> JsoncIndex<JsoncValue<I, F>> for usize
type Indexer = SliceIndexer
source§impl<'a, I, F> JsoncIndexer<&'a str, JsoncValue<I, F>> for StringIndexer
impl<'a, I, F> JsoncIndexer<&'a str, JsoncValue<I, F>> for StringIndexer
type Output = JsoncValue<I, F>
fn get<'b>( value: &'b JsoncValue<I, F>, index: &'a str ) -> Option<&'b Self::Output>
fn get_mut<'b>( value: &'b mut JsoncValue<I, F>, index: &'a str ) -> Option<&'b mut Self::Output>
fn index<'b>(value: &'b JsoncValue<I, F>, index: &'a str) -> &'b Self::Output
fn index_mut<'b>( value: &'b mut JsoncValue<I, F>, index: &'a str ) -> &'b mut Self::Output
source§impl<I, F, S: SliceIndex<[JsoncValue<I, F>]> + JsoncIndex<JsoncValue<I, F>>> JsoncIndexer<S, JsoncValue<I, F>> for SliceIndexer
impl<I, F, S: SliceIndex<[JsoncValue<I, F>]> + JsoncIndex<JsoncValue<I, F>>> JsoncIndexer<S, JsoncValue<I, F>> for SliceIndexer
type Output = <S as SliceIndex<[JsoncValue<I, F>]>>::Output
fn get(value: &JsoncValue<I, F>, index: S) -> Option<&Self::Output>
fn get_mut(value: &mut JsoncValue<I, F>, index: S) -> Option<&mut Self::Output>
fn index(value: &JsoncValue<I, F>, index: S) -> &Self::Output
fn index_mut(value: &mut JsoncValue<I, F>, index: S) -> &mut Self::Output
source§impl<I: PartialEq, F: PartialEq> PartialEq for JsoncValue<I, F>
impl<I: PartialEq, F: PartialEq> PartialEq for JsoncValue<I, F>
source§fn eq(&self, other: &JsoncValue<I, F>) -> bool
fn eq(&self, other: &JsoncValue<I, F>) -> bool
self
and other
values to be equal, and is used
by ==
.