pub enum JsonRpcMessage {
Single(Value),
Batch(Vec<Value>),
}Expand description
Represents a JSON-RPC message that can be either single or batch
Variants§
Implementations§
Source§impl JsonRpcMessage
impl JsonRpcMessage
Sourcepub fn validate(&self) -> Result<(), TransportError>
pub fn validate(&self) -> Result<(), TransportError>
Validate the message according to JSON-RPC and MCP specs
§Errors
Returns an error if the message is invalid according to JSON-RPC or MCP specifications
Sourcepub fn extract_requests(&self) -> Result<Vec<Request>, TransportError>
pub fn extract_requests(&self) -> Result<Vec<Request>, TransportError>
Extract requests from the message (filtering out notifications)
§Errors
Returns an error if request extraction fails
Sourcepub fn extract_notifications(&self) -> Result<Vec<Request>, TransportError>
pub fn extract_notifications(&self) -> Result<Vec<Request>, TransportError>
Sourcepub fn has_requests(&self) -> bool
pub fn has_requests(&self) -> bool
Check if this message contains any requests (vs only notifications)
Trait Implementations§
Source§impl Clone for JsonRpcMessage
impl Clone for JsonRpcMessage
Source§fn clone(&self) -> JsonRpcMessage
fn clone(&self) -> JsonRpcMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for JsonRpcMessage
impl RefUnwindSafe for JsonRpcMessage
impl Send for JsonRpcMessage
impl Sync for JsonRpcMessage
impl Unpin for JsonRpcMessage
impl UnwindSafe for JsonRpcMessage
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