[−][src]Enum json::JsonValue
Variants
Null
Short(Short)
String(String)
Number(Number)
Boolean(bool)
Object(Object)
Array(Vec<JsonValue>)
Methods
impl JsonValue
[src]
impl JsonValue
pub fn new_object() -> JsonValue
[src]
pub fn new_object() -> JsonValue
Create an empty JsonValue::Object
instance.
When creating an object with data, consider using the object!
macro.
pub fn new_array() -> JsonValue
[src]
pub fn new_array() -> JsonValue
Create an empty JsonValue::Array
instance.
When creating array with data, consider using the array!
macro.
pub fn dump(&self) -> String
[src]
pub fn dump(&self) -> String
Prints out the value as JSON string.
pub fn pretty(&self, spaces: u16) -> String
[src]
pub fn pretty(&self, spaces: u16) -> String
Pretty prints out the value as JSON string. Takes an argument that's number of spaces to indent new blocks with.
pub fn to_writer<W: Write>(&self, writer: &mut W)
[src]
pub fn to_writer<W: Write>(&self, writer: &mut W)
: use JsonValue::write
instead
Writes the JSON as byte stream into an implementor of std::io::Write
.
This method is deprecated as it will panic on io errors, use write
instead.
pub fn write<W: Write>(&self, writer: &mut W) -> Result<()>
[src]
pub fn write<W: Write>(&self, writer: &mut W) -> Result<()>
Writes the JSON as byte stream into an implementor of std::io::Write
.
pub fn write_pretty<W: Write>(&self, writer: &mut W, spaces: u16) -> Result<()>
[src]
pub fn write_pretty<W: Write>(&self, writer: &mut W, spaces: u16) -> Result<()>
Writes the JSON as byte stream into an implementor of std::io::Write
.
pub fn is_string(&self) -> bool
[src]
pub fn is_string(&self) -> bool
pub fn is_number(&self) -> bool
[src]
pub fn is_number(&self) -> bool
pub fn is_boolean(&self) -> bool
[src]
pub fn is_boolean(&self) -> bool
pub fn is_null(&self) -> bool
[src]
pub fn is_null(&self) -> bool
pub fn is_object(&self) -> bool
[src]
pub fn is_object(&self) -> bool
pub fn is_array(&self) -> bool
[src]
pub fn is_array(&self) -> bool
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Checks whether the value is empty. Returns true for:
- empty string (
""
) - number
0
- boolean
false
- null
- empty array (
array![]
) - empty object (
object!{}
)
pub fn as_str(&self) -> Option<&str>
[src]
pub fn as_str(&self) -> Option<&str>
pub fn as_number(&self) -> Option<Number>
[src]
pub fn as_number(&self) -> Option<Number>
pub fn as_f64(&self) -> Option<f64>
[src]
pub fn as_f64(&self) -> Option<f64>
pub fn as_f32(&self) -> Option<f32>
[src]
pub fn as_f32(&self) -> Option<f32>
pub fn as_u64(&self) -> Option<u64>
[src]
pub fn as_u64(&self) -> Option<u64>
pub fn as_u32(&self) -> Option<u32>
[src]
pub fn as_u32(&self) -> Option<u32>
pub fn as_u16(&self) -> Option<u16>
[src]
pub fn as_u16(&self) -> Option<u16>
pub fn as_u8(&self) -> Option<u8>
[src]
pub fn as_u8(&self) -> Option<u8>
pub fn as_usize(&self) -> Option<usize>
[src]
pub fn as_usize(&self) -> Option<usize>
pub fn as_i64(&self) -> Option<i64>
[src]
pub fn as_i64(&self) -> Option<i64>
pub fn as_i32(&self) -> Option<i32>
[src]
pub fn as_i32(&self) -> Option<i32>
pub fn as_i16(&self) -> Option<i16>
[src]
pub fn as_i16(&self) -> Option<i16>
pub fn as_i8(&self) -> Option<i8>
[src]
pub fn as_i8(&self) -> Option<i8>
pub fn as_isize(&self) -> Option<isize>
[src]
pub fn as_isize(&self) -> Option<isize>
pub fn as_bool(&self) -> Option<bool>
[src]
pub fn as_bool(&self) -> Option<bool>
pub fn as_fixed_point_u64(&self, point: u16) -> Option<u64>
[src]
pub fn as_fixed_point_u64(&self, point: u16) -> Option<u64>
Obtain an integer at a fixed decimal point. This is useful for converting monetary values and doing arithmetic on them without rounding errors introduced by floating point operations.
Will return None
if Number
called on a value that's not a number,
or if the number is negative or a NaN.
let price_a = JsonValue::from(5.99); let price_b = JsonValue::from(7); let price_c = JsonValue::from(10.2); assert_eq!(price_a.as_fixed_point_u64(2), Some(599)); assert_eq!(price_b.as_fixed_point_u64(2), Some(700)); assert_eq!(price_c.as_fixed_point_u64(2), Some(1020));
pub fn as_fixed_point_i64(&self, point: u16) -> Option<i64>
[src]
pub fn as_fixed_point_i64(&self, point: u16) -> Option<i64>
Analog to as_fixed_point_u64
, except returning a signed
i64
, properly handling negative numbers.
let balance_a = JsonValue::from(-1.49); let balance_b = JsonValue::from(42); assert_eq!(balance_a.as_fixed_point_i64(2), Some(-149)); assert_eq!(balance_b.as_fixed_point_i64(2), Some(4200));
pub fn take(&mut self) -> JsonValue
[src]
pub fn take(&mut self) -> JsonValue
Take over the ownership of the value, leaving Null
in it's place.
Example
let mut data = array!["Foo", 42]; let first = data[0].take(); let second = data[1].take(); assert!(first == "Foo"); assert!(second == 42); assert!(data[0].is_null()); assert!(data[1].is_null());
pub fn take_string(&mut self) -> Option<String>
[src]
pub fn take_string(&mut self) -> Option<String>
Checks that self is a string, returns an owned Rust String
, leaving
Null
in it's place.
-
If the contained string is already a heap allocated
String
, then the ownership is moved without any heap allocation. -
If the contained string is a
Short
, this will perform a heap allocation to convert the types for you.
Example
let mut data = array!["Hello", "World"]; let owned = data[0].take_string().expect("Should be a string"); assert_eq!(owned, "Hello"); assert!(data[0].is_null());
pub fn push<T>(&mut self, value: T) -> Result<()> where
T: Into<JsonValue>,
[src]
pub fn push<T>(&mut self, value: T) -> Result<()> where
T: Into<JsonValue>,
Works on JsonValue::Array
- pushes a new value to the array.
pub fn pop(&mut self) -> JsonValue
[src]
pub fn pop(&mut self) -> JsonValue
Works on JsonValue::Array
- remove and return last element from
an array. On failure returns a null.
pub fn contains<T>(&self, item: T) -> bool where
T: PartialEq<JsonValue>,
[src]
pub fn contains<T>(&self, item: T) -> bool where
T: PartialEq<JsonValue>,
Works on JsonValue::Array
- checks if the array contains a value
pub fn has_key(&self, key: &str) -> bool
[src]
pub fn has_key(&self, key: &str) -> bool
Works on JsonValue::Object
- checks if the object has a key
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns length of array or object (number of keys), defaults to 0
for
other types.
pub fn members(&self) -> Members
[src]
pub fn members(&self) -> Members
Works on JsonValue::Array
- returns an iterator over members.
Will return an empty iterator if called on non-array types.
pub fn members_mut(&mut self) -> MembersMut
[src]
pub fn members_mut(&mut self) -> MembersMut
Works on JsonValue::Array
- returns a mutable iterator over members.
Will return an empty iterator if called on non-array types.
pub fn entries(&self) -> Entries
[src]
pub fn entries(&self) -> Entries
Works on JsonValue::Object
- returns an iterator over key value pairs.
Will return an empty iterator if called on non-object types.
pub fn entries_mut(&mut self) -> EntriesMut
[src]
pub fn entries_mut(&mut self) -> EntriesMut
Works on JsonValue::Object
- returns a mutable iterator over
key value pairs.
Will return an empty iterator if called on non-object types.
pub fn remove(&mut self, key: &str) -> JsonValue
[src]
pub fn remove(&mut self, key: &str) -> JsonValue
Works on JsonValue::Object
- remove a key and return the value it held.
If the key was not present, the method is called on anything but an
object, it will return a null.
pub fn array_remove(&mut self, index: usize) -> JsonValue
[src]
pub fn array_remove(&mut self, index: usize) -> JsonValue
Works on JsonValue::Array
- remove an entry and return the value it held.
If the method is called on anything but an object or if the index is out of bounds, it
will return JsonValue::Null
.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
When called on an array or an object, will wipe them clean. When called on a string will clear the string. Numbers and booleans become null.
Trait Implementations
impl Clone for JsonValue
[src]
impl Clone for JsonValue
fn clone(&self) -> JsonValue
[src]
fn clone(&self) -> JsonValue
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> From<&'a str> for JsonValue
[src]
impl<'a> From<&'a str> for JsonValue
impl<T: Into<JsonValue>> From<Option<T>> for JsonValue
[src]
impl<T: Into<JsonValue>> From<Option<T>> for JsonValue
impl<T: Into<JsonValue>> From<Vec<T>> for JsonValue
[src]
impl<T: Into<JsonValue>> From<Vec<T>> for JsonValue
impl From<HashMap<String, JsonValue, RandomState>> for JsonValue
[src]
impl From<HashMap<String, JsonValue, RandomState>> for JsonValue
impl From<BTreeMap<String, JsonValue>> for JsonValue
[src]
impl From<BTreeMap<String, JsonValue>> for JsonValue
impl From<String> for JsonValue
[src]
impl From<String> for JsonValue
impl From<isize> for JsonValue
[src]
impl From<isize> for JsonValue
impl From<usize> for JsonValue
[src]
impl From<usize> for JsonValue
impl From<i8> for JsonValue
[src]
impl From<i8> for JsonValue
impl From<i16> for JsonValue
[src]
impl From<i16> for JsonValue
impl From<i32> for JsonValue
[src]
impl From<i32> for JsonValue
impl From<i64> for JsonValue
[src]
impl From<i64> for JsonValue
impl From<u8> for JsonValue
[src]
impl From<u8> for JsonValue
impl From<u16> for JsonValue
[src]
impl From<u16> for JsonValue
impl From<u32> for JsonValue
[src]
impl From<u32> for JsonValue
impl From<u64> for JsonValue
[src]
impl From<u64> for JsonValue
impl From<f32> for JsonValue
[src]
impl From<f32> for JsonValue
impl From<f64> for JsonValue
[src]
impl From<f64> for JsonValue
impl From<Number> for JsonValue
[src]
impl From<Number> for JsonValue
impl From<Object> for JsonValue
[src]
impl From<Object> for JsonValue
impl From<bool> for JsonValue
[src]
impl From<bool> for JsonValue
impl Eq for JsonValue
[src]
impl Eq for JsonValue
impl<'a> PartialEq<&'a str> for JsonValue
[src]
impl<'a> PartialEq<&'a str> for JsonValue
fn eq(&self, other: &&str) -> bool
[src]
fn eq(&self, other: &&str) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<JsonValue> for &'a str
[src]
impl<'a> PartialEq<JsonValue> for &'a str
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<str> for JsonValue
[src]
impl PartialEq<str> for JsonValue
fn eq(&self, other: &str) -> bool
[src]
fn eq(&self, other: &str) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<JsonValue> for str
[src]
impl<'a> PartialEq<JsonValue> for str
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<String> for JsonValue
[src]
impl PartialEq<String> for JsonValue
fn eq(&self, other: &String) -> bool
[src]
fn eq(&self, other: &String) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<String> for &'a JsonValue
[src]
impl<'a> PartialEq<String> for &'a JsonValue
fn eq(&self, other: &String) -> bool
[src]
fn eq(&self, other: &String) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for String
[src]
impl PartialEq<JsonValue> for String
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<isize> for JsonValue
[src]
impl PartialEq<isize> for JsonValue
fn eq(&self, other: &isize) -> bool
[src]
fn eq(&self, other: &isize) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<isize> for &'a JsonValue
[src]
impl<'a> PartialEq<isize> for &'a JsonValue
fn eq(&self, other: &isize) -> bool
[src]
fn eq(&self, other: &isize) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for isize
[src]
impl PartialEq<JsonValue> for isize
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<usize> for JsonValue
[src]
impl PartialEq<usize> for JsonValue
fn eq(&self, other: &usize) -> bool
[src]
fn eq(&self, other: &usize) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<usize> for &'a JsonValue
[src]
impl<'a> PartialEq<usize> for &'a JsonValue
fn eq(&self, other: &usize) -> bool
[src]
fn eq(&self, other: &usize) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for usize
[src]
impl PartialEq<JsonValue> for usize
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<i8> for JsonValue
[src]
impl PartialEq<i8> for JsonValue
fn eq(&self, other: &i8) -> bool
[src]
fn eq(&self, other: &i8) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<i8> for &'a JsonValue
[src]
impl<'a> PartialEq<i8> for &'a JsonValue
fn eq(&self, other: &i8) -> bool
[src]
fn eq(&self, other: &i8) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for i8
[src]
impl PartialEq<JsonValue> for i8
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<i16> for JsonValue
[src]
impl PartialEq<i16> for JsonValue
fn eq(&self, other: &i16) -> bool
[src]
fn eq(&self, other: &i16) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<i16> for &'a JsonValue
[src]
impl<'a> PartialEq<i16> for &'a JsonValue
fn eq(&self, other: &i16) -> bool
[src]
fn eq(&self, other: &i16) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for i16
[src]
impl PartialEq<JsonValue> for i16
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<i32> for JsonValue
[src]
impl PartialEq<i32> for JsonValue
fn eq(&self, other: &i32) -> bool
[src]
fn eq(&self, other: &i32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<i32> for &'a JsonValue
[src]
impl<'a> PartialEq<i32> for &'a JsonValue
fn eq(&self, other: &i32) -> bool
[src]
fn eq(&self, other: &i32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for i32
[src]
impl PartialEq<JsonValue> for i32
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<i64> for JsonValue
[src]
impl PartialEq<i64> for JsonValue
fn eq(&self, other: &i64) -> bool
[src]
fn eq(&self, other: &i64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<i64> for &'a JsonValue
[src]
impl<'a> PartialEq<i64> for &'a JsonValue
fn eq(&self, other: &i64) -> bool
[src]
fn eq(&self, other: &i64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for i64
[src]
impl PartialEq<JsonValue> for i64
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<u8> for JsonValue
[src]
impl PartialEq<u8> for JsonValue
fn eq(&self, other: &u8) -> bool
[src]
fn eq(&self, other: &u8) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<u8> for &'a JsonValue
[src]
impl<'a> PartialEq<u8> for &'a JsonValue
fn eq(&self, other: &u8) -> bool
[src]
fn eq(&self, other: &u8) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for u8
[src]
impl PartialEq<JsonValue> for u8
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<u16> for JsonValue
[src]
impl PartialEq<u16> for JsonValue
fn eq(&self, other: &u16) -> bool
[src]
fn eq(&self, other: &u16) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<u16> for &'a JsonValue
[src]
impl<'a> PartialEq<u16> for &'a JsonValue
fn eq(&self, other: &u16) -> bool
[src]
fn eq(&self, other: &u16) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for u16
[src]
impl PartialEq<JsonValue> for u16
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<u32> for JsonValue
[src]
impl PartialEq<u32> for JsonValue
fn eq(&self, other: &u32) -> bool
[src]
fn eq(&self, other: &u32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<u32> for &'a JsonValue
[src]
impl<'a> PartialEq<u32> for &'a JsonValue
fn eq(&self, other: &u32) -> bool
[src]
fn eq(&self, other: &u32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for u32
[src]
impl PartialEq<JsonValue> for u32
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<u64> for JsonValue
[src]
impl PartialEq<u64> for JsonValue
fn eq(&self, other: &u64) -> bool
[src]
fn eq(&self, other: &u64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<u64> for &'a JsonValue
[src]
impl<'a> PartialEq<u64> for &'a JsonValue
fn eq(&self, other: &u64) -> bool
[src]
fn eq(&self, other: &u64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for u64
[src]
impl PartialEq<JsonValue> for u64
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<f32> for JsonValue
[src]
impl PartialEq<f32> for JsonValue
fn eq(&self, other: &f32) -> bool
[src]
fn eq(&self, other: &f32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<f32> for &'a JsonValue
[src]
impl<'a> PartialEq<f32> for &'a JsonValue
fn eq(&self, other: &f32) -> bool
[src]
fn eq(&self, other: &f32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for f32
[src]
impl PartialEq<JsonValue> for f32
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<f64> for JsonValue
[src]
impl PartialEq<f64> for JsonValue
fn eq(&self, other: &f64) -> bool
[src]
fn eq(&self, other: &f64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<f64> for &'a JsonValue
[src]
impl<'a> PartialEq<f64> for &'a JsonValue
fn eq(&self, other: &f64) -> bool
[src]
fn eq(&self, other: &f64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for f64
[src]
impl PartialEq<JsonValue> for f64
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<Number> for JsonValue
[src]
impl PartialEq<Number> for JsonValue
fn eq(&self, other: &Number) -> bool
[src]
fn eq(&self, other: &Number) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<Number> for &'a JsonValue
[src]
impl<'a> PartialEq<Number> for &'a JsonValue
fn eq(&self, other: &Number) -> bool
[src]
fn eq(&self, other: &Number) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for Number
[src]
impl PartialEq<JsonValue> for Number
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<Object> for JsonValue
[src]
impl PartialEq<Object> for JsonValue
fn eq(&self, other: &Object) -> bool
[src]
fn eq(&self, other: &Object) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<Object> for &'a JsonValue
[src]
impl<'a> PartialEq<Object> for &'a JsonValue
fn eq(&self, other: &Object) -> bool
[src]
fn eq(&self, other: &Object) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for Object
[src]
impl PartialEq<JsonValue> for Object
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<bool> for JsonValue
[src]
impl PartialEq<bool> for JsonValue
fn eq(&self, other: &bool) -> bool
[src]
fn eq(&self, other: &bool) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<'a> PartialEq<bool> for &'a JsonValue
[src]
impl<'a> PartialEq<bool> for &'a JsonValue
fn eq(&self, other: &bool) -> bool
[src]
fn eq(&self, other: &bool) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for bool
[src]
impl PartialEq<JsonValue> for bool
fn eq(&self, other: &JsonValue) -> bool
[src]
fn eq(&self, other: &JsonValue) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<JsonValue> for JsonValue
[src]
impl PartialEq<JsonValue> for JsonValue
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Display for JsonValue
[src]
impl Display for JsonValue
Implements formatting
let data = json::parse(r#"{"url":"https://github.com/"}"#).unwrap(); println!("{}", data); println!("{:#}", data);
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for JsonValue
[src]
impl Debug for JsonValue
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Index<usize> for JsonValue
[src]
impl Index<usize> for JsonValue
Implements indexing by usize
to easily access array members:
Example
let mut array = JsonValue::new_array(); array.push("foo"); assert!(array[0] == "foo");
type Output = JsonValue
The returned type after indexing.
fn index(&self, index: usize) -> &JsonValue
[src]
fn index(&self, index: usize) -> &JsonValue
Performs the indexing (container[index]
) operation.
impl<'a> Index<&'a str> for JsonValue
[src]
impl<'a> Index<&'a str> for JsonValue
Implements indexing by &str
to easily access object members:
Example
let object = object!{ "foo" => "bar" }; assert!(object["foo"] == "bar");
type Output = JsonValue
The returned type after indexing.
fn index(&self, index: &str) -> &JsonValue
[src]
fn index(&self, index: &str) -> &JsonValue
Performs the indexing (container[index]
) operation.
impl Index<String> for JsonValue
[src]
impl Index<String> for JsonValue
type Output = JsonValue
The returned type after indexing.
fn index(&self, index: String) -> &JsonValue
[src]
fn index(&self, index: String) -> &JsonValue
Performs the indexing (container[index]
) operation.
impl<'a> Index<&'a String> for JsonValue
[src]
impl<'a> Index<&'a String> for JsonValue
type Output = JsonValue
The returned type after indexing.
fn index(&self, index: &String) -> &JsonValue
[src]
fn index(&self, index: &String) -> &JsonValue
Performs the indexing (container[index]
) operation.
impl IndexMut<usize> for JsonValue
[src]
impl IndexMut<usize> for JsonValue
Implements mutable indexing by usize
to easily modify array members:
Example
let mut array = array!["foo", 3.14]; array[1] = "bar".into(); assert!(array[1] == "bar");
fn index_mut(&mut self, index: usize) -> &mut JsonValue
[src]
fn index_mut(&mut self, index: usize) -> &mut JsonValue
Performs the mutable indexing (container[index]
) operation.
impl<'a> IndexMut<&'a str> for JsonValue
[src]
impl<'a> IndexMut<&'a str> for JsonValue
Implements mutable indexing by &str
to easily modify object members:
Example
let mut object = object!{}; object["foo"] = 42.into(); assert!(object["foo"] == 42);
fn index_mut(&mut self, index: &str) -> &mut JsonValue
[src]
fn index_mut(&mut self, index: &str) -> &mut JsonValue
Performs the mutable indexing (container[index]
) operation.
impl IndexMut<String> for JsonValue
[src]
impl IndexMut<String> for JsonValue
fn index_mut(&mut self, index: String) -> &mut JsonValue
[src]
fn index_mut(&mut self, index: String) -> &mut JsonValue
Performs the mutable indexing (container[index]
) operation.
impl<'a> IndexMut<&'a String> for JsonValue
[src]
impl<'a> IndexMut<&'a String> for JsonValue
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more