sonic_rs

Struct Value

Source
#[repr(C)]
pub struct Value { /* private fields */ }
Expand description

Represents any valid JSON value.

Value can be parsed from a JSON and from any type that implements serde::Serialize.

§Example

use sonic_rs::json;
use sonic_rs::value::Value;

let v1 = json!({"a": 123});
let v2: Value = sonic_rs::from_str(r#"{"a": 123}"#).unwrap();
let v3 = {
    use std::collections::HashMap;
    let mut map: HashMap<&str, i32> = HashMap::new();
    map.insert(&"a", 123);
    sonic_rs::to_value(&map).unwrap()
};

assert_eq!(v1, v2);
assert_eq!(v2, v3);

assert_eq!(v1["a"], 123);

§Notes

Actually the lookup in Value is O(n), not O(1). If you want to use Value as a map, recommend to use serde_json::Value.

Implementations§

Source§

impl Value

Source

pub fn into_object(self) -> Option<Object>

Convert into Object. If the value is not an object, return None.

Source

pub fn into_array(self) -> Option<Array>

Convert into Array. If the value is not an array, return None.

Source§

impl Value

Source

pub const fn new() -> Self

Create a new null Value. It is also the default value of Value.

Source

pub fn as_ref(&self) -> ValueRef<'_>

Create a reference ValueRef from a &Value.

§Example
use sonic_rs::{ValueRef, json, JsonValueTrait};

let v = json!({
   "name": "Xiaoming",
   "age": 18,
});

match v.as_ref() {
    ValueRef::Object(obj) => {
       assert_eq!(obj.get(&"name").unwrap().as_str().unwrap(), "Xiaoming");
       assert_eq!(obj.get(&"age").unwrap().as_i64().unwrap(), 18);
   },
   _ => unreachable!(),
}
Source

pub fn from_static_str(val: &'static str) -> Self

Create a new string Value from a &'static str with zero-copy.

§Example
use sonic_rs::{array, JsonValueTrait, Value};

let s = "hello";
let v1 = Value::from_static_str("hello");
assert_eq!(v1.as_str().unwrap().as_ptr(), s.as_ptr());

let v2 = v1.clone();
assert_eq!(v1.as_str().unwrap().as_ptr(), v2.as_str().unwrap().as_ptr());
Source

pub fn take(&mut self) -> Self

Take the value from the node, and set the node as a empty node. Take will creat a new root node.

§Examples
use sonic_rs::json;
use sonic_rs::JsonValueTrait;

let mut value = json!({"a": 123});
assert_eq!(value.take()["a"], 123);
assert!(value.is_null());

let mut value = json!(null);
assert!(value.take().is_null());
assert!(value.is_null());

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Self

Clone the value, if the value is a root node, we will create a new allocator for it.

§Example
use sonic_rs::json;

let a = json!({"a": [1, 2, 3]});
assert_eq!(a, a.clone());
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

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

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

impl Default for Value

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<D>(deserializer: D) -> StdResult<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from a Deserializer.

§Examples
use sonic_rs::Value;

let v: Value = sonic_rs::from_str(r#"{"a": 1, "b": 2}"#).unwrap();
assert_eq!(v["a"], 1);
assert_eq!(v["b"], 2);
Source§

impl<'de> Deserializer<'de> for &'de Value

Source§

type Error = Error

The error type that can be returned if some error occurs during deserialization.
Source§

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more
Source§

fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i8 value.
Source§

fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i16 value.
Source§

fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i32 value.
Source§

fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i64 value.
Source§

fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an i128 value. Read more
Source§

fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u8 value.
Source§

fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u16 value.
Source§

fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u32 value.
Source§

fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a u64 value.
Source§

fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an u128 value. Read more
Source§

fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f32 value.
Source§

fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a f64 value.
Source§

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an optional value. Read more
Source§

fn deserialize_enum<V>( self, _name: &str, _variants: &'static [&'static str], visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants.
Source§

fn deserialize_newtype_struct<V>( self, _name: &'static str, visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a newtype struct with a particular name.
Source§

fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a bool value.
Source§

fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a char value.
Source§

fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Source§

fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit value.
Source§

fn deserialize_unit_struct<V>( self, _name: &'static str, visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a unit struct with a particular name.
Source§

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values.
Source§

fn deserialize_tuple<V>( self, _len: usize, visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a sequence of values and knows how many values there are without looking at the serialized data.
Source§

fn deserialize_tuple_struct<V>( self, _name: &'static str, _len: usize, visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields.
Source§

fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a map of key-value pairs.
Source§

fn deserialize_struct<V>( self, _name: &'static str, _fields: &'static [&'static str], visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting a struct with a particular name and fields.
Source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant.
Source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Error>
where V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more
Source§

fn is_human_readable(&self) -> bool

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more
Source§

impl Display for Value

Source§

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

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

impl Drop for Value

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> From<&'a [(Value, Value)]> for Value

Source§

fn from(value: &'a [Pair]) -> Self

Converts to this type from the input type.
Source§

impl<T: Clone + Into<Value>> From<&[T]> for Value

Source§

fn from(val: &[T]) -> Self

Convert a slice &[T] to a Value.

§Examples
use sonic_rs::{json, Value};

let x = Value::from(&["hi", "hello"][..]);

assert_eq!(x, json!(["hi", "hello"]));

let x: &[i32] = &[];
assert_eq!(Value::from(x), json!([]));
Source§

impl<T: Clone + Into<Value>, const N: usize> From<&[T; N]> for Value

Source§

fn from(val: &[T; N]) -> Self

Convert a array reference &[T; N] to a Value.

§Examples
use sonic_rs::{Value, json};

let x  = Value::from(&["hi", "hello"]);

assert_eq!(x, json!(["hi", "hello"]));
Source§

impl From<&FastStr> for Value

Source§

fn from(val: &FastStr) -> Self

Converts to this type from the input type.
Source§

impl From<&String> for Value

Source§

fn from(val: &String) -> Self

Convert a string type into a string Value. The string will be copied into the Value.

§Performance

If it is &'static str, recommend to use Value::from_static_str and it is zero-copy.

Source§

impl From<&str> for Value

Source§

fn from(val: &str) -> Self

Convert a string type into a string Value. The string will be copied into the Value.

§Performance

If it is &'static str, recommend to use Value::from_static_str and it is zero-copy.

Source§

impl From<()> for Value

Source§

fn from(_: ()) -> Self

Convert () to Value::Null.

§Examples
use sonic_rs::{JsonValueTrait, Value};

assert!(Value::from(()).is_null());
Source§

impl From<Array> for Value

Source§

fn from(val: Array) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, str>> for Value

Source§

fn from(value: Cow<'a, str>) -> Self

Convert copy-on-write string to a string Value.

§Examples
use std::borrow::Cow;

use sonic_rs::Value;

let s1: Cow<str> = Cow::Borrowed("hello");
let x1 = Value::from(s1);

let s2: Cow<str> = Cow::Owned("hello".to_string());
let x2 = Value::from(s2);

assert_eq!(x1, x2);
Source§

impl From<FastStr> for Value

Source§

fn from(val: FastStr) -> Self

Converts to this type from the input type.
Source§

impl From<Number> for Value

Source§

fn from(val: Number) -> Self

Convert Number to a Value.

§Examples
use sonic_rs::{json, Number, Value};

let x = Value::from(Number::from(7));
assert_eq!(x, json!(7));
Source§

impl From<Object> for Value

Source§

fn from(val: Object) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for Value
where T: Into<Value>,

Source§

fn from(opt: Option<T>) -> Self

Convert Option to Value::Null.

§Examples
use sonic_rs::{JsonValueTrait, Value};

let u = Some(123);
let x = Value::from(u);
assert_eq!(x.as_i64(), u);

let u = None;
let x: Value = u.into();
assert_eq!(x.as_i64(), u);
Source§

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

Source§

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

Convert a Vec to a Value.

§Examples
use sonic_rs::{json, Value};

assert_eq!(Value::from(vec!["hi", "hello"]), json!(["hi", "hello"]));

assert_eq!(Value::from(Vec::<i32>::new()), json!([]));

assert_eq!(
    Value::from(vec![json!(null), json!("hi")]),
    json!([null, "hi"])
);
Source§

impl From<bool> for Value

Source§

fn from(val: bool) -> Self

Convert bool to a boolean Value.

§Examples
use sonic_rs::{JsonValueTrait, Value};

let x: Value = true.into();
assert!(x.is_true());
Source§

impl From<char> for Value

Source§

fn from(val: char) -> Self

Convert char to a string Value.

§Examples
use sonic_rs::{json, Value};

let c: char = '😁';
let x: Value = c.into();
assert_eq!(x, json!("😁"));
Source§

impl From<i16> for Value

Source§

fn from(val: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(val: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(val: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(val: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Value

Source§

fn from(val: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(val: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(val: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(val: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(val: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Value

Source§

fn from(val: usize) -> Self

Converts to this type from the input type.
Source§

impl<'a, K: AsRef<str>, V: Clone + Into<Value>> FromIterator<(K, &'a V)> for Value

Source§

fn from_iter<T: IntoIterator<Item = (K, &'a V)>>(iter: T) -> Self

Create a Value by collecting an iterator of key-value pairs. The key will be copied into the Value.

§Examples
use sonic_rs::{Value, json, object};
use std::collections::HashMap;

let mut map = HashMap::new();
map.insert("sonic_rs", 40);
map.insert("json", 2);

let x: Value = map.iter().collect();
assert_eq!(x, json!({"sonic_rs": 40, "json": 2}));

let x: Value = Value::from_iter(&object!{"sonic_rs": 40, "json": 2});
assert_eq!(x, json!({"sonic_rs": 40, "json": 2}));
Source§

impl<T: Into<Value>> FromIterator<T> for Value

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Create a Value by collecting an iterator of array elements.

§Examples
use std::iter::FromIterator;

use sonic_rs::{json, Value};

let v = std::iter::repeat(6).take(3);
let x: Value = v.collect();
assert_eq!(x, json!([6, 6, 6]));

let x = Value::from_iter(vec!["sonic_rs", "json", "serde"]);
assert_eq!(x, json!(["sonic_rs", "json", "serde"]));
Source§

impl FromStr for Value

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Convert &str to Value. The &str will be copied into the Value.

§Examples
use std::str::FromStr;

use sonic_rs::{JsonValueTrait, Value};

let x = Value::from_str("string").unwrap();
assert_eq!(x.as_str().unwrap(), "string");
§Performance

If it is &'static str, recommend to use Value::from_static_str.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl<I> Index<I> for Value
where I: Index,

Source§

fn index(&self, index: I) -> &Value

Index into an array Value using the syntax value[0] and index into an object Value using the syntax value["k"].

Returns a null Value if the Value type does not match the index, or the index does not exist in the array or object.

For retrieving deeply nested values, you should have a look at the Value::pointer method.

§Examples
use sonic_rs::{json, pointer, JsonValueTrait};

let data = json!({
    "x": {
        "y": ["z", "zz"]
    }
});

assert_eq!(data["x"]["y"], json!(["z", "zz"]));
assert_eq!(data["x"]["y"][0], json!("z"));

assert_eq!(data["a"], json!(null)); // returns null for undefined values
assert_eq!(data["a"]["b"], json!(null)); // does not panic

// use pointer for retrieving nested values
assert_eq!(data.pointer(&pointer!["x", "y", 0]).unwrap(), &json!("z"));
Source§

type Output = Value

The returned type after indexing.
Source§

impl<I: Index> IndexMut<I> for Value

Source§

fn index_mut(&mut self, index: I) -> &mut Value

Write the index of a mutable Value, and use the syntax value[0] = ... in an array and value["k"] = ... in an object.

If the index is a number, the value must be an array of length bigger than the index. Indexing into a value that is not an array or an array that is too small will panic.

If the index is a string, the value must be an object or null which is treated like an empty object. If the key is not already present in the object, it will be inserted with a value of null. Indexing into a value that is neither an object nor null will panic.

§Examples
let mut data = json!({ "x": 0, "z": null });

// replace an existing key
data["x"] = json!(1);

// insert a new key
data["y"] = json!([1, 2, 3]);

// replace an array value
data["y"][0] = json!(true);

// inserted a deeply nested key
data["a"]["b"]["c"]["d"] = json!(true);

//insert an key in a null value
data["z"]["zz"] = json!("insert in null");

data["z"]["zz1"] = object!{}.into();


assert_eq!(data, json!({
  "x": 1,
  "y": [true, 2, 3],
  "a": { "b": {"c": {"d": true}}},
   "z": {"zz": "insert in null", "zz1": {}}
}));
Source§

impl<'de> IntoDeserializer<'de, Error> for &'de Value

Source§

type Deserializer = &'de Value

The type of the deserializer being converted into.
Source§

fn into_deserializer(self) -> Self::Deserializer

Convert this value into a deserializer.
Source§

impl JsonContainerTrait for Value

Source§

type ArrayType = Array

Source§

type ObjectType = Object

Source§

fn as_array(&self) -> Option<&Self::ArrayType>

Returns the array if self is an array. Read more
Source§

fn as_object(&self) -> Option<&Self::ObjectType>

Returns the object if self is an object. Read more
Source§

impl JsonValueMutTrait for Value

Source§

type ValueType = Value

Source§

type ArrayType = Array

Source§

type ObjectType = Object

Source§

fn as_object_mut(&mut self) -> Option<&mut Self::ObjectType>

Returns the mutable object if self is an object. Read more
Source§

fn as_array_mut(&mut self) -> Option<&mut Self::ArrayType>

Returns the mutable array if self is an array. Read more
Source§

fn pointer_mut<P: IntoIterator>( &mut self, path: P, ) -> Option<&mut Self::ValueType>
where P::Item: Index,

Looks up a value by a path. Read more
Source§

fn get_mut<I: Index>(&mut self, index: I) -> Option<&mut Self::ValueType>

Mutably index into a JSON array or map. A string-like index can be used to access a value in a map, and a usize index can be used to access an element of an array. Read more
Source§

impl JsonValueTrait for Value

Source§

type ValueType<'v> = &'v Value where Self: 'v

Source§

fn get_type(&self) -> JsonType

Gets the type of the value. Returns JsonType::Null as default if self is Option::None or Result::Err(_). Read more
Source§

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

Returns the Number if self is a Number. Read more
Source§

fn as_raw_number(&self) -> Option<RawNumber>

Returns the RawNumber without precision loss if self is a Number.
Source§

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

If self meets is_i64, represent it as i64 if possible. Returns None otherwise. Read more
Source§

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

If self meets is_i64, represent it as u64 if possible. Returns None otherwise. Read more
Source§

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

If self is a number, represent it as f64 if possible. Returns None otherwise. The integer number will be converted to f64. Read more
Source§

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

Returns the bool if self is a boolean. Read more
Source§

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

Returns the str if self is a string. Read more
Source§

fn pointer<P: IntoIterator>(&self, path: P) -> Option<Self::ValueType<'_>>
where P::Item: Index,

Looks up a value by a path. Read more
Source§

fn get<I: Index>(&self, index: I) -> Option<Self::ValueType<'_>>

Index into a JSON array or map. A string-like index can be used to access a value in a map, and a usize index can be used to access an element of an array. Read more
Source§

fn is_boolean(&self) -> bool

Returns true if the value is a bool. Read more
Source§

fn is_true(&self) -> bool

Returns true if the value is true. Read more
Source§

fn is_false(&self) -> bool

Returns true if the value is false. Read more
Source§

fn is_null(&self) -> bool

Returns true if the self value is null. Read more
Source§

fn is_number(&self) -> bool

Returns true if the value is a number. Read more
Source§

fn is_str(&self) -> bool

Returns true if the value is a string. Read more
Source§

fn is_array(&self) -> bool

Returns true if the value is an array. Read more
Source§

fn is_object(&self) -> bool

Returns true if the value is an object. Read more
Source§

fn is_f64(&self) -> bool

Returns true if the value is a number and it is an f64. It will returns false if the value is a u64 or i64. Read more
Source§

fn is_i64(&self) -> bool

Returns true if the value is a integer number and it between i64::MIN and i64::MAX Read more
Source§

fn is_u64(&self) -> bool

Returns true if the value is a integer number and it between 0 and i64::MAX Read more
Source§

impl<U> PartialEq<&[U]> for Value
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &&[U]) -> 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<U, const N: usize> PartialEq<&[U; N]> for Value
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &&[U; N]) -> 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<U> PartialEq<&mut [U]> for Value
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &&mut [U]) -> 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 Value

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<U> PartialEq<[U]> for Value
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &[U]) -> 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<U, const N: usize> PartialEq<[U; N]> for Value
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &[U; N]) -> 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<Array> for &Value

Source§

fn eq(&self, other: &Array) -> 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<Array> for &mut Value

Source§

fn eq(&self, other: &Array) -> 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<Array> for Value

Source§

fn eq(&self, other: &Array) -> 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<FastStr> for &Value

Source§

fn eq(&self, other: &FastStr) -> 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<FastStr> for &mut Value

Source§

fn eq(&self, other: &FastStr) -> 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<FastStr> for Value

Source§

fn eq(&self, other: &FastStr) -> 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 &Value

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 &mut Value

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 Value

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<String> for &Value

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 &mut Value

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 Value

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<U> PartialEq<Value> for &[U]
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Value) -> 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<U, const N: usize> PartialEq<Value> for &[U; N]
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Value) -> 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<Value> for &Array

Source§

fn eq(&self, other: &Value) -> 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<Value> for &Object

Source§

fn eq(&self, other: &Value) -> 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<U> PartialEq<Value> for &mut [U]
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Value) -> 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<Value> for &mut Array

Source§

fn eq(&self, other: &Value) -> 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<Value> for &mut Object

Source§

fn eq(&self, other: &Value) -> 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<Value> for &str

Source§

fn eq(&self, other: &Value) -> 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<U> PartialEq<Value> for [U]
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Value) -> 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<U, const N: usize> PartialEq<Value> for [U; N]
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Value) -> 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<Value> for Array

Source§

fn eq(&self, other: &Value) -> 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<Value> for FastStr

Source§

fn eq(&self, other: &Value) -> 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<Value> for Object

Source§

fn eq(&self, other: &Value) -> 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<Value> for String

Source§

fn eq(&self, other: &Value) -> 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<U> PartialEq<Value> for Vec<U>
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Value) -> 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<Value> for bool

Source§

fn eq(&self, other: &Value) -> 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<Value> for f32

Source§

fn eq(&self, other: &Value) -> 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<Value> for f64

Source§

fn eq(&self, other: &Value) -> 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<Value> for i16

Source§

fn eq(&self, other: &Value) -> 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<Value> for i32

Source§

fn eq(&self, other: &Value) -> 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<Value> for i64

Source§

fn eq(&self, other: &Value) -> 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<Value> for i8

Source§

fn eq(&self, other: &Value) -> 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<Value> for isize

Source§

fn eq(&self, other: &Value) -> 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<Value> for str

Source§

fn eq(&self, other: &Value) -> 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<Value> for u16

Source§

fn eq(&self, other: &Value) -> 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<Value> for u32

Source§

fn eq(&self, other: &Value) -> 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<Value> for u64

Source§

fn eq(&self, other: &Value) -> 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<Value> for u8

Source§

fn eq(&self, other: &Value) -> 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<Value> for usize

Source§

fn eq(&self, other: &Value) -> 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<U> PartialEq<Vec<U>> for Value
where Value: PartialEq<U>,

Source§

fn eq(&self, other: &Vec<U>) -> 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 &Value

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 &mut Value

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 Value

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<f32> for &Value

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 &mut Value

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 Value

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<f64> for &Value

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 &mut Value

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 Value

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<i16> for &Value

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 &mut Value

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 Value

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<i32> for &Value

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 &mut Value

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 Value

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<i64> for &Value

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 &mut Value

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 Value

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<i8> for &Value

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 &mut Value

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 Value

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<isize> for &Value

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 &mut Value

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 Value

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 &Value

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 PartialEq<str> for &mut Value

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 PartialEq<str> for Value

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 PartialEq<u16> for &Value

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 &mut Value

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 Value

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<u32> for &Value

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 &mut Value

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 Value

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<u64> for &Value

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 &mut Value

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 Value

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<u8> for &Value

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 &mut Value

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 Value

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<usize> for &Value

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 &mut Value

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 Value

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 Value

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 Serialize for Value

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'de> TryFrom<LazyValue<'de>> for Value

Try parse a LazyValue into a Value. LazyValue is always a valid JSON, at least it is followed the JSON syntax.

However, in some cases, the parse will failed and return errors, such as the float number in JSON is inifity.

Source§

type Error = Error

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

fn try_from(value: LazyValue<'de>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<f32> for Value

Source§

fn try_from(value: f32) -> Result<Self, Self::Error>

Try convert a f32 to Value. If the float is NaN or infinity, return a error.

§Examples
use sonic_rs::{JsonValueTrait, Value};

let f1: f32 = 2.333;
let x1: Value = f1.try_into().unwrap();
assert_eq!(x1, f1);

let x2: Value = f32::INFINITY.try_into().unwrap_or_default();
let x3: Value = f32::NAN.try_into().unwrap_or_default();

assert!(x2.is_null() && x3.is_null());
Source§

type Error = Error

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

impl TryFrom<f64> for Value

Source§

type Error = Error

Try convert a f64 to Value. If the float is NaN or infinity, return a error.

§Examples
use sonic_rs::{JsonValueTrait, Value};

let f1: f64 = 2.333;
let x1: Value = f1.try_into().unwrap();
assert_eq!(x1, 2.333);

let x2: Value = f64::INFINITY.try_into().unwrap_or_default();
let x3: Value = f64::NAN.try_into().unwrap_or_default();

assert!(x2.is_null() && x3.is_null());
Source§

fn try_from(value: f64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for Value

Source§

impl Send for Value

Source§

impl Sync for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl !RefUnwindSafe for Value

§

impl Unpin for Value

§

impl !UnwindSafe for Value

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 T)

🔬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§

default 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,