Enum ruma::signatures::CanonicalJsonValue [−][src]
pub enum CanonicalJsonValue { Null, Bool(bool), Integer(Int), String(String), Array(Vec<CanonicalJsonValue, Global>), Object(BTreeMap<String, CanonicalJsonValue>), }
signatures
only.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();
Bool(bool)
Represents a JSON boolean.
let v: CanonicalJsonValue = json!(true).try_into().unwrap();
Integer(Int)
Represents a JSON integer.
let v: CanonicalJsonValue = json!(12).try_into().unwrap();
String(String)
Represents a JSON string.
let v: CanonicalJsonValue = json!("a string").try_into().unwrap();
Array(Vec<CanonicalJsonValue, Global>)
Represents a JSON array.
let v: CanonicalJsonValue = json!(["an", "array"]).try_into().unwrap();
Object(BTreeMap<String, CanonicalJsonValue>)
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();
Implementations
impl CanonicalJsonValue
[src]
impl CanonicalJsonValue
[src]pub fn as_bool(&self) -> Option<bool>
[src]
This is supported on crate feature api
only.
pub fn as_bool(&self) -> Option<bool>
[src]api
only.If the CanonicalJsonValue
is a Bool
, return the inner value.
pub fn as_integer(&self) -> Option<Int>
[src]
This is supported on crate feature api
only.
pub fn as_integer(&self) -> Option<Int>
[src]api
only.If the CanonicalJsonValue
is an Integer
, return the inner value.
pub fn as_str(&self) -> Option<&str>
[src]
This is supported on crate feature api
only.
pub fn as_str(&self) -> Option<&str>
[src]api
only.If the CanonicalJsonValue
is a String
, return a reference to the inner value.
pub fn as_array(&self) -> Option<&[CanonicalJsonValue]>
[src]
This is supported on crate feature api
only.
pub fn as_array(&self) -> Option<&[CanonicalJsonValue]>
[src]api
only.If the CanonicalJsonValue
is an Array
, return a reference to the inner value.
pub fn as_object(&self) -> Option<&BTreeMap<String, CanonicalJsonValue>>
[src]
This is supported on crate feature api
only.
pub fn as_object(&self) -> Option<&BTreeMap<String, CanonicalJsonValue>>
[src]api
only.If the CanonicalJsonValue
is an Object
, return a reference to the inner value.
pub fn as_array_mut(&mut self) -> Option<&mut Vec<CanonicalJsonValue, Global>>
[src]
This is supported on crate feature api
only.
pub fn as_array_mut(&mut self) -> Option<&mut Vec<CanonicalJsonValue, Global>>
[src]api
only.If the CanonicalJsonValue
is an Array
, return a mutable reference to the inner value.
pub fn as_object_mut(
&mut self
) -> Option<&mut BTreeMap<String, CanonicalJsonValue>>
[src]
This is supported on crate feature api
only.
pub fn as_object_mut(
&mut self
) -> Option<&mut BTreeMap<String, CanonicalJsonValue>>
[src]api
only.If the CanonicalJsonValue
is an Object
, return a mutable reference to the inner value.
pub fn is_bool(&self) -> bool
[src]
This is supported on crate feature api
only.
pub fn is_bool(&self) -> bool
[src]api
only.Returns true
if the CanonicalJsonValue
is a Bool
.
pub fn is_integer(&self) -> bool
[src]
This is supported on crate feature api
only.
pub fn is_integer(&self) -> bool
[src]api
only.Returns true
if the CanonicalJsonValue
is an Integer
.
pub fn is_string(&self) -> bool
[src]
This is supported on crate feature api
only.
pub fn is_string(&self) -> bool
[src]api
only.Returns true
if the CanonicalJsonValue
is a String
.
Trait Implementations
impl Clone for CanonicalJsonValue
[src]
impl Clone for CanonicalJsonValue
[src]pub fn clone(&self) -> CanonicalJsonValue
[src]
pub fn clone(&self) -> CanonicalJsonValue
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for CanonicalJsonValue
[src]
impl Debug for CanonicalJsonValue
[src]impl Default for CanonicalJsonValue
[src]
impl Default for CanonicalJsonValue
[src]pub fn default() -> CanonicalJsonValue
[src]
pub fn default() -> CanonicalJsonValue
[src]Returns the “default value” for a type. Read more
impl<'de> Deserialize<'de> for CanonicalJsonValue
[src]
impl<'de> Deserialize<'de> for CanonicalJsonValue
[src]pub fn deserialize<D>(
deserializer: D
) -> Result<CanonicalJsonValue, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<CanonicalJsonValue, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Display for CanonicalJsonValue
[src]
impl Display for CanonicalJsonValue
[src]pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
[src]
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
[src]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}
.
impl From<BTreeMap<String, CanonicalJsonValue>> for CanonicalJsonValue
[src]
impl From<BTreeMap<String, CanonicalJsonValue>> for CanonicalJsonValue
[src]pub fn from(val: BTreeMap<String, CanonicalJsonValue>) -> CanonicalJsonValue
[src]
pub fn from(val: BTreeMap<String, CanonicalJsonValue>) -> CanonicalJsonValue
[src]Performs the conversion.
impl From<CanonicalJsonValue> for Value
[src]
impl From<CanonicalJsonValue> for Value
[src]pub fn from(val: CanonicalJsonValue) -> Value
[src]
pub fn from(val: CanonicalJsonValue) -> Value
[src]Performs the conversion.
impl From<Int> for CanonicalJsonValue
[src]
impl From<Int> for CanonicalJsonValue
[src]pub fn from(val: Int) -> CanonicalJsonValue
[src]
pub fn from(val: Int) -> CanonicalJsonValue
[src]Performs the conversion.
impl From<String> for CanonicalJsonValue
[src]
impl From<String> for CanonicalJsonValue
[src]pub fn from(val: String) -> CanonicalJsonValue
[src]
pub fn from(val: String) -> CanonicalJsonValue
[src]Performs the conversion.
impl From<Vec<CanonicalJsonValue, Global>> for CanonicalJsonValue
[src]
impl From<Vec<CanonicalJsonValue, Global>> for CanonicalJsonValue
[src]pub fn from(val: Vec<CanonicalJsonValue, Global>) -> CanonicalJsonValue
[src]
pub fn from(val: Vec<CanonicalJsonValue, Global>) -> CanonicalJsonValue
[src]Performs the conversion.
impl From<bool> for CanonicalJsonValue
[src]
impl From<bool> for CanonicalJsonValue
[src]pub fn from(val: bool) -> CanonicalJsonValue
[src]
pub fn from(val: bool) -> CanonicalJsonValue
[src]Performs the conversion.
impl PartialEq<BTreeMap<String, CanonicalJsonValue>> for CanonicalJsonValue
[src]
impl PartialEq<BTreeMap<String, CanonicalJsonValue>> for CanonicalJsonValue
[src]impl PartialEq<CanonicalJsonValue> for CanonicalJsonValue
[src]
impl PartialEq<CanonicalJsonValue> for CanonicalJsonValue
[src]pub fn eq(&self, other: &CanonicalJsonValue) -> bool
[src]
pub fn eq(&self, other: &CanonicalJsonValue) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
pub fn ne(&self, other: &CanonicalJsonValue) -> bool
[src]
pub fn ne(&self, other: &CanonicalJsonValue) -> bool
[src]This method tests for !=
.
impl PartialEq<CanonicalJsonValue> for Vec<CanonicalJsonValue, Global>
[src]
impl PartialEq<CanonicalJsonValue> for Vec<CanonicalJsonValue, Global>
[src]impl PartialEq<CanonicalJsonValue> for BTreeMap<String, CanonicalJsonValue>
[src]
impl PartialEq<CanonicalJsonValue> for BTreeMap<String, CanonicalJsonValue>
[src]impl PartialEq<Int> for CanonicalJsonValue
[src]
impl PartialEq<Int> for CanonicalJsonValue
[src]impl PartialEq<String> for CanonicalJsonValue
[src]
impl PartialEq<String> for CanonicalJsonValue
[src]impl PartialEq<Vec<CanonicalJsonValue, Global>> for CanonicalJsonValue
[src]
impl PartialEq<Vec<CanonicalJsonValue, Global>> for CanonicalJsonValue
[src]impl PartialEq<bool> for CanonicalJsonValue
[src]
impl PartialEq<bool> for CanonicalJsonValue
[src]impl Serialize for CanonicalJsonValue
[src]
impl Serialize for CanonicalJsonValue
[src]pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]Serialize this value into the given Serde serializer. Read more
impl TryFrom<Value> for CanonicalJsonValue
[src]
impl TryFrom<Value> for CanonicalJsonValue
[src]impl Eq for CanonicalJsonValue
[src]
impl StructuralEq for CanonicalJsonValue
[src]
impl StructuralPartialEq for CanonicalJsonValue
[src]
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
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
impl<T> WithSubscriber for T
[src]fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
fn with_current_subscriber(self) -> WithDispatch<Self>
[src]
fn with_current_subscriber(self) -> WithDispatch<Self>
[src]Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,