pub struct Response<R> { /* private fields */ }Expand description
JSON-RPC Response object
Implementations§
Source§impl<R> Response<R>
impl<R> Response<R>
Sourcepub fn into_parts(self) -> (Id, HandlerResponse<R>)
pub fn into_parts(self) -> (Id, HandlerResponse<R>)
Split the Response object into its parts (useful for 3rd party serialization)
Sourcepub fn from_parts(id: Id, handler_response: HandlerResponse<R>) -> Response<R>
pub fn from_parts(id: Id, handler_response: HandlerResponse<R>) -> Response<R>
Combine the parts into a Response object (useful for 3rd party de-serialization)
Sourcepub fn from_handler_response(
id: Id,
handler_response: HandlerResponse<R>,
) -> Response<R>
pub fn from_handler_response( id: Id, handler_response: HandlerResponse<R>, ) -> Response<R>
Create a new Response object with the given ID and result from the RPC handler response
Sourcepub fn into_error_response(self, rpc_error: RpcError) -> Response<R>
pub fn into_error_response(self, rpc_error: RpcError) -> Response<R>
Convert the response into an error response with the given error
Sourcepub fn into_server_error_response(self, error: String) -> Response<R>
pub fn into_server_error_response(self, error: String) -> Response<R>
Get the handler response
Sourcepub fn from_server_error(id: Id, error: String) -> Response<R>
pub fn from_server_error(id: Id, error: String) -> Response<R>
Create a new Response object with the given ID and error message
Trait Implementations§
Source§impl<'de, R> Deserialize<'de> for Response<R>where
R: Deserialize<'de>,
impl<'de, R> Deserialize<'de> for Response<R>where
R: Deserialize<'de>,
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<R> Freeze for Response<R>where
R: Freeze,
impl<R> RefUnwindSafe for Response<R>where
R: RefUnwindSafe,
impl<R> Send for Response<R>where
R: Send,
impl<R> Sync for Response<R>where
R: Sync,
impl<R> Unpin for Response<R>where
R: Unpin,
impl<R> UnsafeUnpin for Response<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for Response<R>where
R: UnwindSafe,
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