Struct Response

Source
pub struct Response<S, R, D>
where S: AsRef<str>,
{ pub id: usize, pub jsonrpc: Version, pub result: Option<R>, pub error: Option<Error<S, D>>, }
Expand description

When a rpc call is made, the Server MUST reply with a Response, except for in the case of Notifications.

visit here for details

Fields§

§id: usize

This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation.

§jsonrpc: Version

A String specifying the version of the JSON-RPC protocol. MUST be exactly “2.0”.

§result: Option<R>

This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.

§error: Option<Error<S, D>>

This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation.

Trait Implementations§

Source§

impl<S, R: Debug, D: Debug> Debug for Response<S, R, D>
where S: AsRef<str> + Debug,

Source§

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

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

impl<S, R: Default, D: Default> Default for Response<S, R, D>
where S: AsRef<str> + Default,

Source§

fn default() -> Response<S, R, D>

Returns the “default value” for a type. Read more
Source§

impl<'de, S, R, D> Deserialize<'de> for Response<S, R, D>
where S: AsRef<str> + Deserialize<'de>, R: Deserialize<'de>, D: 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<S, R: PartialEq, D: PartialEq> PartialEq for Response<S, R, D>
where S: AsRef<str> + PartialEq,

Source§

fn eq(&self, other: &Response<S, R, D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S, R, D> Serialize for Response<S, R, D>
where S: AsRef<str> + Serialize, R: Serialize, D: 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<S, R, D> StructuralPartialEq for Response<S, R, D>
where S: AsRef<str>,

Auto Trait Implementations§

§

impl<S, R, D> Freeze for Response<S, R, D>
where R: Freeze, S: Freeze, D: Freeze,

§

impl<S, R, D> RefUnwindSafe for Response<S, R, D>

§

impl<S, R, D> Send for Response<S, R, D>
where R: Send, S: Send, D: Send,

§

impl<S, R, D> Sync for Response<S, R, D>
where R: Sync, S: Sync, D: Sync,

§

impl<S, R, D> Unpin for Response<S, R, D>
where R: Unpin, S: Unpin, D: Unpin,

§

impl<S, R, D> UnwindSafe for Response<S, R, D>
where R: UnwindSafe, S: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where T: for<'de> Deserialize<'de>,