Enum serde_cbor::value::ObjectKey
[−]
[src]
pub enum ObjectKey { Integer(i64), Bytes(Vec<u8>), String(String), Bool(bool), Null, }
A simplified CBOR value containing only types useful for keys.
Variants
Integer(i64)
An integer.
Bytes(Vec<u8>)
A byte string.
String(String)
An UTF-8 string.
Bool(bool)
A boolean value.
Null
No value.
Methods
impl ObjectKey
[src]
fn is_bytes(&self) -> bool
Returns true if the ObjectKey is a byte string.
fn as_bytes(&self) -> Option<&Vec<u8>>
Returns the associated byte string or None
if the ObjectKey has a different type.
fn as_bytes_mut(&mut self) -> Option<&mut Vec<u8>>
Returns the associated mutable byte string or None
if the ObjectKey has a different type.
fn is_string(&self) -> bool
Returns true if the ObjectKey is a string.
fn as_string(&self) -> Option<&String>
Returns the associated string or None
if the *ObjectKey` has a different type.
fn as_string_mut(&mut self) -> Option<&mut String>
Returns the associated mutable string or None
if the ObjectKey
has a different type.
fn is_number(&self) -> bool
Retrns true if the ObjectKey
is a number.
fn as_i64(&self) -> Option<i64>
If the ObjectKey
is a number, return or cast it to a i64. Returns None otherwise.
fn as_u64(&self) -> Option<u64>
If the ObjectKey
is a number, return or cast it to a u64. Returns None otherwise.
fn is_boolean(&self) -> bool
Returns true if the ObjectKey is a boolean.
fn as_boolean(&self) -> Option<bool>
If the ObjectKey is a Boolean, returns the associated bool. Returns None otherwise.
fn is_null(&self) -> bool
Returns true if the ObjectKey is a Null. Returns false otherwise.
fn as_null(&self) -> Option<()>
If the ObjectKey is a Null, returns (). Returns None otherwise.
Trait Implementations
impl Hash for ObjectKey
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl Ord for ObjectKey
[src]
fn cmp(&self, __arg_0: &ObjectKey) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialOrd for ObjectKey
[src]
fn partial_cmp(&self, __arg_0: &ObjectKey) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &ObjectKey) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &ObjectKey) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &ObjectKey) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &ObjectKey) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Eq for ObjectKey
[src]
impl PartialEq for ObjectKey
[src]
fn eq(&self, __arg_0: &ObjectKey) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ObjectKey) -> bool
This method tests for !=
.
impl Debug for ObjectKey
[src]
impl Clone for ObjectKey
[src]
fn clone(&self) -> ObjectKey
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Deserialize for ObjectKey
[src]
fn deserialize<D>(deserializer: &mut D) -> Result<ObjectKey, D::Error> where D: Deserializer
Deserialize this value given this Deserializer
.
impl Serialize for ObjectKey
[src]
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer
Serializes this value into this serializer.