#[repr(C)]pub struct Request { /* private fields */ }
Expand description
A JSON-RPC request object
Implementations§
Source§impl Request
impl Request
Sourcepub fn jsonrpc(&self) -> Option<&str>
pub fn jsonrpc(&self) -> Option<&str>
Gets the JSON-RPC identifier string.
This value should always be "2.0"
, but may also be null or malformed.
Sourcepub fn set_method(&mut self, method: &str)
pub fn set_method(&mut self, method: &str)
Sets the method.
Sourcepub fn with_method(self, method: &str) -> Self
pub fn with_method(self, method: &str) -> Self
Builder function to set method.
Sourcepub fn params_is_null(&self) -> bool
pub fn params_is_null(&self) -> bool
Gets whether the params field is null.
Sourcepub fn params<T: for<'de> Deserialize<'de>>(&self) -> Result<T>
pub fn params<T: for<'de> Deserialize<'de>>(&self) -> Result<T>
Gets the Request parameters.
Attempts to parse the parameter as the provided type, returns Err(_)
on failure.
Sourcepub fn set_params<T: Serialize>(&mut self, params: T)
pub fn set_params<T: Serialize>(&mut self, params: T)
Sets the Request parameters.
Sourcepub fn with_params<T: Serialize>(self, params: T) -> Self
pub fn with_params<T: Serialize>(self, params: T) -> Self
Builder function to set the Request parameters.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Request
impl<'de> Deserialize<'de> for Request
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
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