pub struct BatchRequest {
pub requests: Vec<BatchRequestItem>,
}Expand description
A JSON-RPC batch request containing multiple requests/notifications
Fields§
§requests: Vec<BatchRequestItem>The individual requests in the batch
Implementations§
Source§impl BatchRequest
impl BatchRequest
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a batch request with initial capacity
Sourcepub fn add_request(self, request: JsonRpcRequest) -> Self
pub fn add_request(self, request: JsonRpcRequest) -> Self
Add a request to the batch
Sourcepub fn add_notification(self, notification: JsonRpcNotification) -> Self
pub fn add_notification(self, notification: JsonRpcNotification) -> Self
Add a notification to the batch
Sourcepub fn add_call<T: Serialize>(
self,
id: RequestId,
method: String,
params: Option<T>,
) -> McpResult<Self>
pub fn add_call<T: Serialize>( self, id: RequestId, method: String, params: Option<T>, ) -> McpResult<Self>
Add a method call as a request
Sourcepub fn add_notify<T: Serialize>(
self,
method: String,
params: Option<T>,
) -> McpResult<Self>
pub fn add_notify<T: Serialize>( self, method: String, params: Option<T>, ) -> McpResult<Self>
Add a method call as a notification
Sourcepub fn split(self) -> (Vec<JsonRpcRequest>, Vec<JsonRpcNotification>)
pub fn split(self) -> (Vec<JsonRpcRequest>, Vec<JsonRpcNotification>)
Split batch into requests and notifications
Trait Implementations§
Source§impl Clone for BatchRequest
impl Clone for BatchRequest
Source§fn clone(&self) -> BatchRequest
fn clone(&self) -> BatchRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchRequest
impl Debug for BatchRequest
Source§impl Default for BatchRequest
impl Default for BatchRequest
Source§impl<'de> Deserialize<'de> for BatchRequest
impl<'de> Deserialize<'de> for BatchRequest
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
Source§impl From<Vec<JsonRpcNotification>> for BatchRequest
impl From<Vec<JsonRpcNotification>> for BatchRequest
Source§fn from(notifications: Vec<JsonRpcNotification>) -> Self
fn from(notifications: Vec<JsonRpcNotification>) -> Self
Converts to this type from the input type.
Source§impl From<Vec<JsonRpcRequest>> for BatchRequest
impl From<Vec<JsonRpcRequest>> for BatchRequest
Source§fn from(requests: Vec<JsonRpcRequest>) -> Self
fn from(requests: Vec<JsonRpcRequest>) -> Self
Converts to this type from the input type.
Source§impl PartialEq for BatchRequest
impl PartialEq for BatchRequest
Source§fn eq(&self, other: &BatchRequest) -> bool
fn eq(&self, other: &BatchRequest) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for BatchRequest
impl Serialize for BatchRequest
impl StructuralPartialEq for BatchRequest
Auto Trait Implementations§
impl Freeze for BatchRequest
impl RefUnwindSafe for BatchRequest
impl Send for BatchRequest
impl Sync for BatchRequest
impl Unpin for BatchRequest
impl UnsafeUnpin for BatchRequest
impl UnwindSafe for BatchRequest
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>,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].