pub enum RequestId {
String(String),
Number(i64),
Null,
}Expand description
Request ID supporting string, numeric, and null formats per JSON-RPC 2.0 specification
The JSON-RPC 2.0 specification allows request IDs to be strings, numbers, or null. This enum supports all three variants for complete JSON-RPC 2.0 compliance.
§Examples
use airsprotocols_mcp::protocol::RequestId;
let string_id = RequestId::String("req-123".to_string());
let numeric_id = RequestId::Number(42);
let null_id = RequestId::Null;
// Serialization preserves the original format
assert_eq!(serde_json::to_string(&string_id).unwrap(), r#""req-123""#);
assert_eq!(serde_json::to_string(&numeric_id).unwrap(), "42");
assert_eq!(serde_json::to_string(&null_id).unwrap(), "null");Variants§
String(String)
String-based request identifier
Number(i64)
Numeric request identifier
Null
Null request identifier
Implementations§
Source§impl RequestId
impl RequestId
Sourcepub fn new_string(id: impl Into<String>) -> Self
pub fn new_string(id: impl Into<String>) -> Self
Create a new string-based request ID
§Examples
use airsprotocols_mcp::protocol::RequestId;
let id = RequestId::new_string("my-request-id");Sourcepub fn new_number(id: i64) -> Self
pub fn new_number(id: i64) -> Self
Create a new numeric request ID
§Examples
use airsprotocols_mcp::protocol::RequestId;
let id = RequestId::new_number(123);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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.