Struct jsonrpsee_core::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_borrowed(t: &'a T) -> Self
pub fn success_borrowed(t: &'a T) -> Self
Create a successful borrowed response payload.
sourcepub fn error(e: impl Into<ErrorObjectOwned>) -> Self
pub fn error(e: impl Into<ErrorObjectOwned>) -> Self
Create an error response payload.
sourcepub fn error_borrowed(e: impl Into<ErrorObject<'a>>) -> Self
pub fn error_borrowed(e: impl Into<ErrorObject<'a>>) -> Self
Create a borrowd error response payload.
sourcepub fn notify_on_completion(self) -> (Self, MethodResponseFuture)
pub fn notify_on_completion(self) -> (Self, 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: Clone> From<ResponsePayload<'a, T>> for ResponsePayload<'a, T>
impl<'a, T: Clone> From<ResponsePayload<'a, T>> for ResponsePayload<'a, T>
source§fn from(inner: InnerResponsePayload<'a, T>) -> Self
fn from(inner: InnerResponsePayload<'a, T>) -> Self
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, Self::Output>
fn into_response(self) -> ResponsePayload<'static, Self::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