#[repr(C)]pub struct Response { /* private fields */ }
Expand description
A JSON-RPC response object
Implementations§
Source§impl Response
impl Response
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 result_is_null(&self) -> bool
pub fn result_is_null(&self) -> bool
Gets whether the result field is null.
Sourcepub fn result<T: for<'de> Deserialize<'de>>(&self) -> Result<T>
pub fn result<T: for<'de> Deserialize<'de>>(&self) -> Result<T>
Gets the Response result.
Attempts to parse the result as the provided type, returns Err(_)
on failure.
Sourcepub fn set_result<T: Serialize>(&mut self, result: T)
pub fn set_result<T: Serialize>(&mut self, result: T)
Sets the Response parameters.
Sourcepub fn with_result<T: Serialize>(self, result: T) -> Self
pub fn with_result<T: Serialize>(self, result: T) -> Self
Builder function to set the Response parameters.
Sourcepub fn error_is_null(&self) -> bool
pub fn error_is_null(&self) -> bool
Gets whether the error field is null.
Sourcepub fn with_error(self, error: Error) -> Self
pub fn with_error(self, error: Error) -> Self
Builder function to set error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
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 Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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