Struct json_rpc2::Request[][src]

pub struct Request { /* fields omitted */ }

JSON-RPC request.

Implementations

impl Request[src]

pub fn new(method: &str, params: Option<Value>) -> Self[src]

Create a new request.

pub fn id(&self) -> &Value[src]

The id for the request.

pub fn method(&self) -> &str[src]

The request service method name.

pub fn params(&self) -> &Option<Value>[src]

The request parameters.

pub fn matches(&self, name: &str) -> bool[src]

Determine if the given name matches the request method.

pub fn deserialize<T: DeserializeOwned>(&mut self) -> Result<T>[src]

Deserialize and consume the message parameters into type T.

If this request message has no parameters or the params payload cannot be converted to T this will return Error::InvalidParams.

Trait Implementations

impl Clone for Request[src]

impl Debug for Request[src]

impl<'de> Deserialize<'de> for Request[src]

impl<'a> From<&'a mut Request> for Response[src]

impl Serialize for Request[src]

Auto Trait Implementations

impl RefUnwindSafe for Request

impl Send for Request

impl Sync for Request

impl Unpin for Request

impl UnwindSafe for Request

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,