pub enum RequestId {
Number(i64),
Integer(String),
String(String),
}Expand description
JSON-RPC request ID.
Variants§
Number(i64)
Integer ID.
Integer(String)
An arbitrary-precision mathematical-integer ID preserving its admitted JSON number lexeme for an exact response echo.
String(String)
String ID.
Implementations§
Source§impl RequestId
impl RequestId
Sourcepub fn validate(&self) -> Result<(), &'static str>
pub fn validate(&self) -> Result<(), &'static str>
Verifies that this ID can be represented within the JSON-RPC wire limits enforced by this crate.
§Errors
Returns an error for a string ID whose canonical JSON encoding exceeds
MAX_JSONRPC_STRING_ID_ENCODED_BYTES. Raw decoders must additionally
enforce the byte length of the received token before escape decoding.
Sourcepub fn correlation_key(&self) -> Result<CorrelationKey, &'static str>
pub fn correlation_key(&self) -> Result<CorrelationKey, &'static str>
Produces the canonical key used by request registries and correlation.
Sourcepub fn correlates_with(&self, other: &Self) -> bool
pub fn correlates_with(&self, other: &Self) -> bool
Returns whether two wire IDs identify the same JSON-RPC request.
Numeric spellings compare by exact mathematical-integer value, while a string remains distinct from every numeric ID.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RequestId
impl<'de> Deserialize<'de> for RequestId
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 Eq for RequestId
impl StructuralPartialEq for RequestId
Auto Trait Implementations§
impl Freeze for RequestId
impl RefUnwindSafe for RequestId
impl Send for RequestId
impl Sync for RequestId
impl Unpin for RequestId
impl UnsafeUnpin for RequestId
impl UnwindSafe for RequestId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).