pub enum Id<'a> {
Null,
Str(Cow<'a, str>),
Int(i64),
Uint(u64),
Float(f64),
}
Expand description
A request identifier.
JSON-RPC 2.0 clients can use this to match responses sent back by a complying server with the request they sent. This is especially useful when sending multiple requests at the same time without waiting for a response in between.
Variants§
Null
The ID was null
.
Str(Cow<'a, str>)
The ID was a string.
Int(i64)
The ID was a signed integer.
Uint(u64)
The ID was an unsigned integer.
Float(f64)
The ID was a floating point number.
§Note
THe JSON-RPC 2.0 specification specifies that a client should not use floating point values as request IDs, but they technically are legal. For this reason, we have to account for them.
Implementations§
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Id<'a>where
'de: 'a,
impl<'de, 'a> Deserialize<'de> for Id<'a>where
'de: 'a,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> StructuralPartialEq for Id<'a>
Auto Trait Implementations§
impl<'a> Freeze for Id<'a>
impl<'a> RefUnwindSafe for Id<'a>
impl<'a> Send for Id<'a>
impl<'a> Sync for Id<'a>
impl<'a> Unpin for Id<'a>
impl<'a> UnwindSafe for Id<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more