pub struct ResponseHandler;Expand description
Response handler for WebSocket messages
Implementations§
Source§impl ResponseHandler
impl ResponseHandler
Sourcepub fn parse_response(&self, data: &str) -> Result<JsonRpcResponse, Error>
pub fn parse_response(&self, data: &str) -> Result<JsonRpcResponse, Error>
Parse a JSON-RPC response
Sourcepub fn is_success(&self, response: &JsonRpcResponse) -> bool
pub fn is_success(&self, response: &JsonRpcResponse) -> bool
Check if response is successful
Sourcepub fn extract_result<'a>(
&self,
response: &'a JsonRpcResponse,
) -> Option<&'a Value>
pub fn extract_result<'a>( &self, response: &'a JsonRpcResponse, ) -> Option<&'a Value>
Extract result from successful response
Sourcepub fn extract_error<'a>(
&self,
response: &'a JsonRpcResponse,
) -> Option<&'a JsonRpcError>
pub fn extract_error<'a>( &self, response: &'a JsonRpcResponse, ) -> Option<&'a JsonRpcError>
Extract error from response
Trait Implementations§
Source§impl Clone for ResponseHandler
impl Clone for ResponseHandler
Source§fn clone(&self) -> ResponseHandler
fn clone(&self) -> ResponseHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResponseHandler
impl Debug for ResponseHandler
Auto Trait Implementations§
impl Freeze for ResponseHandler
impl RefUnwindSafe for ResponseHandler
impl Send for ResponseHandler
impl Sync for ResponseHandler
impl Unpin for ResponseHandler
impl UnwindSafe for ResponseHandler
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