Enum jrpc::Id
[−]
[src]
pub enum Id { String(String), Int(i64), Null, }
An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts
The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
Examples
extern crate serde_json; use jrpc::Id; assert_eq!(Id::from(4), Id::Int(4)); assert_eq!( serde_json::from_str::<Id>("4").unwrap(), Id::Int(4), ); assert_eq!( serde_json::from_str::<Id>("\"foo\"").unwrap(), Id::String("foo".into()), ); assert_eq!( serde_json::from_str::<Id>("null").unwrap(), Id::Null, );
Variants
String(String)
An String id
Int(i64)
An Number id that must be an integer.
We intentionally do not allow floating point values.
Null
A null id
Trait Implementations
impl Debug for Id
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for Id
[src]
fn clone(&self) -> Id
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Id
[src]
impl PartialEq for Id
[src]
fn eq(&self, __arg_0: &Id) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Id) -> bool
[src]
This method tests for !=
.
impl Hash for Id
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more