pub struct JsonRpcBatch<M>(/* private fields */);Available on crate feature
unstable_protocol_v2 only.Expand description
A non-empty JSON-RPC 2.0 batch message.
Implementations§
Source§impl<M> JsonRpcBatch<M>
impl<M> JsonRpcBatch<M>
Sourcepub fn new(
messages: Vec<JsonRpcMessage<M>>,
) -> Result<JsonRpcBatch<M>, EmptyJsonRpcBatch>
pub fn new( messages: Vec<JsonRpcMessage<M>>, ) -> Result<JsonRpcBatch<M>, EmptyJsonRpcBatch>
Creates a non-empty JSON-RPC batch.
Returns an error if messages is empty, because JSON-RPC 2.0 treats an
empty batch array as an invalid request.
§Errors
Returns EmptyJsonRpcBatch when messages is empty.
Sourcepub fn as_slice(&self) -> &[JsonRpcMessage<M>]
pub fn as_slice(&self) -> &[JsonRpcMessage<M>]
Returns the messages in this batch.
Sourcepub fn into_vec(self) -> Vec<JsonRpcMessage<M>>
pub fn into_vec(self) -> Vec<JsonRpcMessage<M>>
Consumes this batch and returns its messages.
Trait Implementations§
Source§impl<M> Clone for JsonRpcBatch<M>where
M: Clone,
impl<M> Clone for JsonRpcBatch<M>where
M: Clone,
Source§fn clone(&self) -> JsonRpcBatch<M>
fn clone(&self) -> JsonRpcBatch<M>
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<M> Debug for JsonRpcBatch<M>where
M: Debug,
impl<M> Debug for JsonRpcBatch<M>where
M: Debug,
Source§impl<'de, M> Deserialize<'de> for JsonRpcBatch<M>where
M: Deserialize<'de>,
impl<'de, M> Deserialize<'de> for JsonRpcBatch<M>where
M: Deserialize<'de>,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<JsonRpcBatch<M>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<JsonRpcBatch<M>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<M> Eq for JsonRpcBatch<M>where
M: Eq,
Source§impl IntoV1Many for JsonRpcBatch<Notification<AgentNotification>>
impl IntoV1Many for JsonRpcBatch<Notification<AgentNotification>>
Source§type Output = JsonRpcMessage<Notification<AgentNotification>>
type Output = JsonRpcMessage<Notification<AgentNotification>>
The corresponding v1 item type.
Source§fn into_v1_many(
self,
) -> Result<Vec<<JsonRpcBatch<Notification<AgentNotification>> as IntoV1Many>::Output>, ProtocolConversionError>
fn into_v1_many( self, ) -> Result<Vec<<JsonRpcBatch<Notification<AgentNotification>> as IntoV1Many>::Output>, ProtocolConversionError>
Converts this value into one or more corresponding v1 items. Read more
Source§impl<M> JsonSchema for JsonRpcBatch<M>where
M: JsonSchema,
impl<M> JsonSchema for JsonRpcBatch<M>where
M: JsonSchema,
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl<M> PartialEq for JsonRpcBatch<M>where
M: PartialEq,
impl<M> PartialEq for JsonRpcBatch<M>where
M: PartialEq,
Source§fn eq(&self, other: &JsonRpcBatch<M>) -> bool
fn eq(&self, other: &JsonRpcBatch<M>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<M> Serialize for JsonRpcBatch<M>where
M: Serialize,
impl<M> Serialize for JsonRpcBatch<M>where
M: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<M> StructuralPartialEq for JsonRpcBatch<M>where
M: PartialEq,
Source§impl<M> TryFrom<Vec<JsonRpcMessage<M>>> for JsonRpcBatch<M>
impl<M> TryFrom<Vec<JsonRpcMessage<M>>> for JsonRpcBatch<M>
Source§type Error = EmptyJsonRpcBatch
type Error = EmptyJsonRpcBatch
The type returned in the event of a conversion error.
Source§fn try_from(
messages: Vec<JsonRpcMessage<M>>,
) -> Result<JsonRpcBatch<M>, <JsonRpcBatch<M> as TryFrom<Vec<JsonRpcMessage<M>>>>::Error>
fn try_from( messages: Vec<JsonRpcMessage<M>>, ) -> Result<JsonRpcBatch<M>, <JsonRpcBatch<M> as TryFrom<Vec<JsonRpcMessage<M>>>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl<M> Freeze for JsonRpcBatch<M>
impl<M> RefUnwindSafe for JsonRpcBatch<M>where
M: RefUnwindSafe,
impl<M> Send for JsonRpcBatch<M>where
M: Send,
impl<M> Sync for JsonRpcBatch<M>where
M: Sync,
impl<M> Unpin for JsonRpcBatch<M>where
M: Unpin,
impl<M> UnsafeUnpin for JsonRpcBatch<M>
impl<M> UnwindSafe for JsonRpcBatch<M>where
M: UnwindSafe,
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,
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§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: 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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.