Enum ruma_serde::CanonicalJsonValue [−][src]
pub enum CanonicalJsonValue { Null, Bool(bool), Integer(Int), String(String), Array(Vec<CanonicalJsonValue>), Object(Object), }
Expand description
Represents a canonical JSON value as per the Matrix specification.
Variants
Represents a JSON null value.
let v: CanonicalJsonValue = json!(null).try_into().unwrap();
Represents a JSON boolean.
let v: CanonicalJsonValue = json!(true).try_into().unwrap();
Tuple Fields of Bool
0: bool
Represents a JSON integer.
let v: CanonicalJsonValue = json!(12).try_into().unwrap();
Tuple Fields of Integer
0: Int
Represents a JSON string.
let v: CanonicalJsonValue = json!("a string").try_into().unwrap();
Tuple Fields of String
0: String
Represents a JSON array.
let v: CanonicalJsonValue = json!(["an", "array"]).try_into().unwrap();
Tuple Fields of Array
Represents a JSON object.
The map is backed by a BTreeMap to guarantee the sorting of keys.
let v: CanonicalJsonValue = json!({ "an": "object" }).try_into().unwrap();
Tuple Fields of Object
0: Object
Implementations
If the CanonicalJsonValue
is a Bool
, return the inner value.
If the CanonicalJsonValue
is an Integer
, return the inner value.
If the CanonicalJsonValue
is a String
, return a reference to the inner value.
If the CanonicalJsonValue
is an Array
, return a reference to the inner value.
If the CanonicalJsonValue
is an Object
, return a reference to the inner value.
If the CanonicalJsonValue
is an Array
, return a mutable reference to the inner value.
If the CanonicalJsonValue
is an Object
, return a mutable reference to the inner value.
Returns true
if the CanonicalJsonValue
is an Integer
.
Trait Implementations
fn deserialize<D>(deserializer: D) -> Result<CanonicalJsonValue, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<CanonicalJsonValue, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Display this value as a string.
This Display
implementation is intentionally unaffected by any formatting parameters,
because adding extra whitespace or otherwise pretty-printing it would make it not the
canonical form anymore.
If you want to pretty-print a CanonicalJsonValue
for debugging purposes, use
one of serde_json::{to_string_pretty, to_vec_pretty, to_writer_pretty}
.
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for CanonicalJsonValue
impl Send for CanonicalJsonValue
impl Sync for CanonicalJsonValue
impl Unpin for CanonicalJsonValue
impl UnwindSafe for CanonicalJsonValue
Blanket Implementations
Mutably borrows from an owned value. Read more