jzon

Enum JsonValue

Source
pub enum JsonValue {
    Null,
    Short(Short),
    String(String),
    Number(Number),
    Boolean(bool),
    Object(Object),
    Array(Vec<JsonValue>),
}

Variants§

§

Null

§

Short(Short)

§

String(String)

§

Number(Number)

§

Boolean(bool)

§

Object(Object)

§

Array(Vec<JsonValue>)

Implementations§

Source§

impl JsonValue

Source

pub fn new_object() -> JsonValue

Create an empty JsonValue::Object instance. When creating an object with data, consider using the object! macro.

Source

pub fn new_array() -> JsonValue

Create an empty JsonValue::Array instance. When creating array with data, consider using the array! macro.

Source

pub fn dump(&self) -> String

Prints out the value as JSON string.

Source

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.

Source

pub fn to_writer<W: Write>(&self, writer: &mut W)

👎Deprecated since 0.10.2: 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.

Source

pub fn write<W: Write>(&self, writer: &mut W) -> Result<()>

Writes the JSON as byte stream into an implementor of std::io::Write.

Source

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.

Source

pub fn is_string(&self) -> bool

Source

pub fn is_number(&self) -> bool

Source

pub fn is_boolean(&self) -> bool

Source

pub fn is_null(&self) -> bool

Source

pub fn is_object(&self) -> bool

Source

pub fn is_array(&self) -> bool

Source

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!{})
Source

pub fn as_str(&self) -> Option<&str>

Source

pub fn as_number(&self) -> Option<Number>

Source

pub fn as_f64(&self) -> Option<f64>

Source

pub fn as_f32(&self) -> Option<f32>

Source

pub fn as_u64(&self) -> Option<u64>

Source

pub fn as_u32(&self) -> Option<u32>

Source

pub fn as_u16(&self) -> Option<u16>

Source

pub fn as_u8(&self) -> Option<u8>

Source

pub fn as_usize(&self) -> Option<usize>

Source

pub fn as_i64(&self) -> Option<i64>

Source

pub fn as_i32(&self) -> Option<i32>

Source

pub fn as_i16(&self) -> Option<i16>

Source

pub fn as_i8(&self) -> Option<i8>

Source

pub fn as_isize(&self) -> Option<isize>

Source

pub fn as_bool(&self) -> Option<bool>

Source

pub fn as_object(&self) -> Option<&Object>

Source

pub fn as_object_mut(&mut self) -> Option<&mut Object>

Source

pub fn as_array(&self) -> Option<&Vec<JsonValue>>

Source

pub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>

Source

pub fn get(&self, key: &str) -> Option<&JsonValue>

If self is a JsonValue::Object, then this looks up an entry by its key in the object.

If self is not a JsonValue::Object, then this method returns None.

Source

pub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>

If self is a JsonValue::Object, then this looks up an entry by its key in the object.

If self is not a JsonValue::Object, then this method returns None.

Source

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));
Source

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));
Source

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());
Source

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());
Source

pub fn push<T>(&mut self, value: T) -> Result<()>
where T: Into<JsonValue>,

Works on JsonValue::Array - pushes a new value to the array.

Source

pub fn pop(&mut self) -> JsonValue

Works on JsonValue::Array - remove and return last element from an array. On failure returns a null.

Source

pub fn contains<T>(&self, item: T) -> bool
where T: PartialEq<JsonValue>,

Works on JsonValue::Array - checks if the array contains a value

Source

pub fn has_key(&self, key: &str) -> bool

Works on JsonValue::Object - checks if the object has a key

Source

pub fn len(&self) -> usize

Returns length of array or object (number of keys), defaults to 0 for other types.

Source

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.

§Example
let animals = array!["Cat", "Dog", "Snail"];
let mut animals_with_letter_a = Vec::new();
for animal in animals.members() {
    if animal.as_str().unwrap().contains('a') {
        animals_with_letter_a.push(animal);
    }
}
assert_eq!(animals_with_letter_a, vec!["Cat", "Snail"]);
Source

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.

Source

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.

§Example
let heights = jzon::parse(r#"
{
    "Alice": 1.42,
    "Bob": 1.6,
    "Carlos": 2.1
}
"#).unwrap();
let mut total_height = 0.0;
let mut names_with_o: Vec<&str> = Vec::new();
for (name, height) in heights.entries() {
    total_height += height.as_f64().unwrap();
    if name.contains('o') {
        names_with_o.push(name);
    }
}
assert_eq!(total_height, 5.12);
assert_eq!(names_with_o, vec!["Bob", "Carlos"]);
Source

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.

Source

pub fn insert<T>(&mut self, key: &str, value: T) -> Result<()>
where T: Into<JsonValue>,

Works on JsonValue::Object - inserts a new entry, or override an existing one into the object. Note that key has to be a &str slice and not an owned String. The internals of Object will handle the heap allocation of the key if needed for better performance.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for JsonValue

Source§

fn clone(&self) -> JsonValue

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JsonValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for JsonValue

Implements formatting

let data = jzon::parse(r#"{"url":"https://github.com/"}"#).unwrap();
println!("{}", data);
println!("{:#}", data);
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T: Into<JsonValue> + Clone> From<&'a [T]> for JsonValue

Source§

fn from(val: &'a [T]) -> JsonValue

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for JsonValue

Source§

fn from(val: &'a str) -> JsonValue

Converts to this type from the input type.
Source§

impl<K: AsRef<str>, V: Into<JsonValue>> From<BTreeMap<K, V>> for JsonValue

Source§

fn from(val: BTreeMap<K, V>) -> JsonValue

Converts to this type from the input type.
Source§

impl<K: AsRef<str>, V: Into<JsonValue>> From<HashMap<K, V>> for JsonValue

Source§

fn from(val: HashMap<K, V>) -> JsonValue

Converts to this type from the input type.
Source§

impl From<Number> for JsonValue

Source§

fn from(val: Number) -> JsonValue

Converts to this type from the input type.
Source§

impl From<Object> for JsonValue

Source§

fn from(val: Object) -> JsonValue

Converts to this type from the input type.
Source§

impl<T: Into<JsonValue>> From<Option<T>> for JsonValue

Source§

fn from(val: Option<T>) -> JsonValue

Converts to this type from the input type.
Source§

impl From<String> for JsonValue

Source§

fn from(val: String) -> JsonValue

Converts to this type from the input type.
Source§

impl<T: Into<JsonValue>> From<Vec<T>> for JsonValue

Source§

fn from(val: Vec<T>) -> JsonValue

Converts to this type from the input type.
Source§

impl From<bool> for JsonValue

Source§

fn from(val: bool) -> JsonValue

Converts to this type from the input type.
Source§

impl From<f32> for JsonValue

Source§

fn from(val: f32) -> JsonValue

Converts to this type from the input type.
Source§

impl From<f64> for JsonValue

Source§

fn from(val: f64) -> JsonValue

Converts to this type from the input type.
Source§

impl From<i16> for JsonValue

Source§

fn from(val: i16) -> JsonValue

Converts to this type from the input type.
Source§

impl From<i32> for JsonValue

Source§

fn from(val: i32) -> JsonValue

Converts to this type from the input type.
Source§

impl From<i64> for JsonValue

Source§

fn from(val: i64) -> JsonValue

Converts to this type from the input type.
Source§

impl From<i8> for JsonValue

Source§

fn from(val: i8) -> JsonValue

Converts to this type from the input type.
Source§

impl From<isize> for JsonValue

Source§

fn from(val: isize) -> JsonValue

Converts to this type from the input type.
Source§

impl From<u16> for JsonValue

Source§

fn from(val: u16) -> JsonValue

Converts to this type from the input type.
Source§

impl From<u32> for JsonValue

Source§

fn from(val: u32) -> JsonValue

Converts to this type from the input type.
Source§

impl From<u64> for JsonValue

Source§

fn from(val: u64) -> JsonValue

Converts to this type from the input type.
Source§

impl From<u8> for JsonValue

Source§

fn from(val: u8) -> JsonValue

Converts to this type from the input type.
Source§

impl From<usize> for JsonValue

Source§

fn from(val: usize) -> JsonValue

Converts to this type from the input type.
Source§

impl<'a> Index<&'a String> for JsonValue

Source§

type Output = JsonValue

The returned type after indexing.
Source§

fn index(&self, index: &String) -> &JsonValue

Performs the indexing (container[index]) operation. Read more
Source§

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");
Source§

type Output = JsonValue

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &JsonValue

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<String> for JsonValue

Source§

type Output = JsonValue

The returned type after indexing.
Source§

fn index(&self, index: String) -> &JsonValue

Performs the indexing (container[index]) operation. Read more
Source§

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");
Source§

type Output = JsonValue

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &JsonValue

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IndexMut<&'a String> for JsonValue

Source§

fn index_mut(&mut self, index: &String) -> &mut JsonValue

Performs the mutable indexing (container[index]) operation. Read more
Source§

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);
Source§

fn index_mut(&mut self, index: &str) -> &mut JsonValue

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IndexMut<String> for JsonValue

Source§

fn index_mut(&mut self, index: String) -> &mut JsonValue

Performs the mutable indexing (container[index]) operation. Read more
Source§

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");
Source§

fn index_mut(&mut self, index: usize) -> &mut JsonValue

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a> PartialEq<&'a str> for JsonValue

Source§

fn eq(&self, other: &&str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<JsonValue> for &'a str

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for Number

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for Object

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for String

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for bool

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for f32

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for f64

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for i16

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for i32

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for i64

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for i8

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for isize

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<JsonValue> for str

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for u16

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for u32

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for u64

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for u8

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<JsonValue> for usize

Source§

fn eq(&self, other: &JsonValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<Number> for &'a JsonValue

Source§

fn eq(&self, other: &Number) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Number> for JsonValue

Source§

fn eq(&self, other: &Number) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<Object> for &'a JsonValue

Source§

fn eq(&self, other: &Object) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Object> for JsonValue

Source§

fn eq(&self, other: &Object) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<String> for &'a JsonValue

Source§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<String> for JsonValue

Source§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<bool> for &'a JsonValue

Source§

fn eq(&self, other: &bool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<bool> for JsonValue

Source§

fn eq(&self, other: &bool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<f32> for &'a JsonValue

Source§

fn eq(&self, other: &f32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f32> for JsonValue

Source§

fn eq(&self, other: &f32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<f64> for &'a JsonValue

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f64> for JsonValue

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<i16> for &'a JsonValue

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i16> for JsonValue

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<i32> for &'a JsonValue

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i32> for JsonValue

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<i64> for &'a JsonValue

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i64> for JsonValue

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<i8> for &'a JsonValue

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i8> for JsonValue

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<isize> for &'a JsonValue

Source§

fn eq(&self, other: &isize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<isize> for JsonValue

Source§

fn eq(&self, other: &isize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<str> for JsonValue

Source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<u16> for &'a JsonValue

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u16> for JsonValue

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<u32> for &'a JsonValue

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u32> for JsonValue

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<u64> for &'a JsonValue

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u64> for JsonValue

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<u8> for &'a JsonValue

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u8> for JsonValue

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<usize> for &'a JsonValue

Source§

fn eq(&self, other: &usize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<usize> for JsonValue

Source§

fn eq(&self, other: &usize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for JsonValue

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for JsonValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.