pub struct Response<'a, T: Clone> {
pub jsonrpc: Option<TwoPointZero>,
pub payload: ResponsePayload<'a, T>,
pub id: Id<'a>,
pub extensions: Extensions,
}
Expand description
JSON-RPC response object as defined in the spec.
Fields§
§jsonrpc: Option<TwoPointZero>
JSON-RPC version.
payload: ResponsePayload<'a, T>
Payload which can be result or error.
id: Id<'a>
Request ID
extensions: Extensions
Extensions
Implementations§
Source§impl<'a, T: Clone> Response<'a, T>
impl<'a, T: Clone> Response<'a, T>
Sourcepub fn new(payload: ResponsePayload<'a, T>, id: Id<'a>) -> Response<'a, T>
pub fn new(payload: ResponsePayload<'a, T>, id: Id<'a>) -> Response<'a, T>
Create a new Response
.
Sourcepub fn new_with_extensions(
payload: ResponsePayload<'a, T>,
id: Id<'a>,
ext: Extensions,
) -> Response<'a, T>
pub fn new_with_extensions( payload: ResponsePayload<'a, T>, id: Id<'a>, ext: Extensions, ) -> Response<'a, T>
Create a new Response
with extensions
Sourcepub fn into_owned(self) -> Response<'static, T>
pub fn into_owned(self) -> Response<'static, T>
Create an owned Response
.
Sourcepub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
Get the extensions of the response.
Sourcepub fn extensions_mut(&mut self) -> &mut Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
Get the mutable ref to the extensions of the response.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Response<'de, T>where
T: Deserialize<'de> + Clone,
impl<'de, T> Deserialize<'de> for Response<'de, T>where
T: Deserialize<'de> + Clone,
Auto Trait Implementations§
impl<'a, T> Freeze for Response<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for Response<'a, T>
impl<'a, T> Send for Response<'a, T>
impl<'a, T> Sync for Response<'a, T>where
T: Sync,
impl<'a, T> Unpin for Response<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Response<'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