pub struct JsonRpcBatch<M>(/* private fields */);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> 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
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> 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
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