Struct jsonrpsee_server::ResponsePayload
source · pub struct ResponsePayload<'a, T>where
T: Clone,{ /* private fields */ }
Expand description
Similar to jsonrpsee_types::ResponsePayload
but possible to with an async-like
API to detect when a method response has been sent.
Implementations§
source§impl<'a, T> ResponsePayload<'a, T>where
T: Clone,
impl<'a, T> ResponsePayload<'a, T>where
T: Clone,
sourcepub fn success(t: T) -> ResponsePayload<'a, T>
pub fn success(t: T) -> ResponsePayload<'a, T>
Create a successful owned response payload.
sourcepub fn success_borrowed(t: &'a T) -> ResponsePayload<'a, T>
pub fn success_borrowed(t: &'a T) -> ResponsePayload<'a, T>
Create a successful borrowed response payload.
sourcepub fn error(e: impl Into<ErrorObject<'static>>) -> ResponsePayload<'a, T>
pub fn error(e: impl Into<ErrorObject<'static>>) -> ResponsePayload<'a, T>
Create an error response payload.
sourcepub fn error_borrowed(e: impl Into<ErrorObject<'a>>) -> ResponsePayload<'a, T>
pub fn error_borrowed(e: impl Into<ErrorObject<'a>>) -> ResponsePayload<'a, T>
Create a borrowd error response payload.
sourcepub fn notify_on_completion(
self,
) -> (ResponsePayload<'a, T>, MethodResponseFuture)
pub fn notify_on_completion( self, ) -> (ResponsePayload<'a, T>, MethodResponseFuture)
Consumes the ResponsePayload
and produces new ResponsePayload
and a future
MethodResponseFuture
that will be resolved once the response has been processed.
If this has been called more than once then this will overwrite the old result the previous future(s) will be resolved with error.
sourcepub fn into_owned(self) -> ResponsePayload<'static, T>
pub fn into_owned(self) -> ResponsePayload<'static, T>
Convert the response payload into owned.
Trait Implementations§
source§impl<'a, T> Debug for ResponsePayload<'a, T>
impl<'a, T> Debug for ResponsePayload<'a, T>
source§impl<'a, T> From<ErrorCode> for ResponsePayload<'a, T>where
T: Clone,
impl<'a, T> From<ErrorCode> for ResponsePayload<'a, T>where
T: Clone,
source§fn from(code: ErrorCode) -> ResponsePayload<'a, T>
fn from(code: ErrorCode) -> ResponsePayload<'a, T>
Converts to this type from the input type.
source§impl<'a, T> From<ResponsePayload<'a, T>> for ResponsePayload<'a, T>where
T: Clone,
impl<'a, T> From<ResponsePayload<'a, T>> for ResponsePayload<'a, T>where
T: Clone,
source§fn from(inner: ResponsePayload<'a, T>) -> ResponsePayload<'a, T>
fn from(inner: ResponsePayload<'a, T>) -> ResponsePayload<'a, T>
Converts to this type from the input type.
source§impl<T> IntoResponse for ResponsePayload<'static, T>
impl<T> IntoResponse for ResponsePayload<'static, T>
source§fn into_response(
self,
) -> ResponsePayload<'static, <ResponsePayload<'static, T> as IntoResponse>::Output>
fn into_response( self, ) -> ResponsePayload<'static, <ResponsePayload<'static, T> as IntoResponse>::Output>
Something that can be converted into a JSON-RPC method call response.
Auto Trait Implementations§
impl<'a, T> Freeze for ResponsePayload<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for ResponsePayload<'a, T>
impl<'a, T> Send for ResponsePayload<'a, T>
impl<'a, T> Sync for ResponsePayload<'a, T>where
T: Sync,
impl<'a, T> Unpin for ResponsePayload<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for ResponsePayload<'a, T>
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