pub struct MiddlewareMethodResponse { /* private fields */ }
Available on crate feature
client
only.Expand description
Middleware method response which can be either a method call or a subscription response. and treated differently.
Implementations§
Source§impl MiddlewareMethodResponse
impl MiddlewareMethodResponse
Sourcepub fn response(rp: RawResponseOwned) -> Self
pub fn response(rp: RawResponseOwned) -> Self
Create a new MiddlewareMethodResponse
which is plain response.
Sourcepub fn subscription_response(
rp: RawResponseOwned,
subscription: SubscriptionResponse,
) -> Self
pub fn subscription_response( rp: RawResponseOwned, subscription: SubscriptionResponse, ) -> Self
Create a new MiddlewareMethodResponse
which is a subscription response.
Sourcepub fn into_parts(self) -> (RawResponseOwned, Option<SubscriptionResponse>)
pub fn into_parts(self) -> (RawResponseOwned, Option<SubscriptionResponse>)
Convert the response into parts.
Sourcepub fn into_response(self) -> RawResponseOwned
pub fn into_response(self) -> RawResponseOwned
Extract the response.
Sourcepub fn into_subscription(self) -> Option<SubscriptionResponse>
pub fn into_subscription(self) -> Option<SubscriptionResponse>
Extract the subscription response if it is a subscription.
Methods from Deref<Target = RawResponseOwned>§
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Whether this response is successful JSON-RPC response.
Sourcepub fn as_error(&self) -> Option<&ErrorObject<'_>>
pub fn as_error(&self) -> Option<&ErrorObject<'_>>
Extract the error object from the response if it is an error.
Sourcepub fn as_success(&self) -> Option<&RawValue>
pub fn as_success(&self) -> Option<&RawValue>
Omits JSON-RPC specific fields like jsonrpc
and id
.
Trait Implementations§
Source§impl Debug for MiddlewareMethodResponse
impl Debug for MiddlewareMethodResponse
Source§impl Deref for MiddlewareMethodResponse
impl Deref for MiddlewareMethodResponse
Auto Trait Implementations§
impl Freeze for MiddlewareMethodResponse
impl !RefUnwindSafe for MiddlewareMethodResponse
impl Send for MiddlewareMethodResponse
impl Sync for MiddlewareMethodResponse
impl Unpin for MiddlewareMethodResponse
impl !UnwindSafe for MiddlewareMethodResponse
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