Struct json_rpc_types::Request

source ·
pub struct Request<P, T = StrBuf<32>> {
    pub jsonrpc: Version,
    pub method: T,
    pub params: Option<P>,
    pub id: Option<Id>,
}
Expand description

Request representation.

Note that omitting id means that request is notification, rather than call, which expects response. This can be used to indicate lack of interest in response.

Type parameters:

  • P - to specify type of params field, which is optional. Normally it should be collection of values or object. But choice is yours.
  • T - specifies textual type. By default it uses static buffer of 32 bytes, which is more than enough in normal cases.

Fields§

§jsonrpc: Version

A String specifying the version of the JSON-RPC protocol.

§method: T

A String containing the name of the method to be invoked

By default is static buffer of 32 bytes.

§params: Option<P>

A Structured value that holds the parameter values to be used during the invocation of the method

§id: Option<Id>

An identifier established by the Client.

If not present, request is notification to which there should be no response.

Implementations§

source§

impl<P, T> Request<P, T>

source

pub const fn is_notification(&self) -> bool

Returns whether request is notification.

Trait Implementations§

source§

impl<P: Clone, T: Clone> Clone for Request<P, T>

source§

fn clone(&self) -> Request<P, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<P: Debug, T: Debug> Debug for Request<P, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, P, T> Deserialize<'de> for Request<P, T>where P: Deserialize<'de>, T: Deserialize<'de>,

source§

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<P: PartialEq, T: PartialEq> PartialEq<Request<P, T>> for Request<P, T>

source§

fn eq(&self, other: &Request<P, T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<P, T> Serialize for Request<P, T>where P: Serialize, T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<P, T> StructuralPartialEq for Request<P, T>

Auto Trait Implementations§

§

impl<P, T> RefUnwindSafe for Request<P, T>where P: RefUnwindSafe, T: RefUnwindSafe,

§

impl<P, T> Send for Request<P, T>where P: Send, T: Send,

§

impl<P, T> Sync for Request<P, T>where P: Sync, T: Sync,

§

impl<P, T> Unpin for Request<P, T>where P: Unpin, T: Unpin,

§

impl<P, T> UnwindSafe for Request<P, T>where P: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,