Struct jsonrpsee_core::server::helpers::MethodResponse
source · pub struct MethodResponse {
pub result: String,
pub success_or_error: MethodResponseResult,
}
Available on crate feature
server
only.Expand description
Represent the response to a method call.
Fields§
§result: String
Serialized JSON-RPC response,
success_or_error: MethodResponseResult
Indicates whether the call was successful or not.
Implementations§
source§impl MethodResponse
impl MethodResponse
sourcepub fn response<T>(
id: Id<'_>,
result: ResponsePayload<'_, T>,
max_response_size: usize
) -> Selfwhere
T: Serialize + Clone,
pub fn response<T>( id: Id<'_>, result: ResponsePayload<'_, T>, max_response_size: usize ) -> Selfwhere T: Serialize + Clone,
Send a JSON-RPC response to the client. If the serialization of result
exceeds max_response_size
,
an error will be sent instead.
sourcepub fn error<'a>(id: Id<'_>, err: impl Into<ErrorObject<'a>>) -> Self
pub fn error<'a>(id: Id<'_>, err: impl Into<ErrorObject<'a>>) -> Self
Create a MethodResponse
from an error.
Trait Implementations§
source§impl Clone for MethodResponse
impl Clone for MethodResponse
source§fn clone(&self) -> MethodResponse
fn clone(&self) -> MethodResponse
Returns a copy 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 moreAuto Trait Implementations§
impl RefUnwindSafe for MethodResponse
impl Send for MethodResponse
impl Sync for MethodResponse
impl Unpin for MethodResponse
impl UnwindSafe for MethodResponse
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