pub struct Response {
pub request_id: RequestId,
pub payload: ResponsePayload,
}Expand description
A server response to a client request.
Fields§
§request_id: RequestIdRequest ID this is responding to.
payload: ResponsePayloadThe response payload.
Implementations§
Source§impl Response
impl Response
Sourcepub fn new(request_id: RequestId, payload: ResponsePayload) -> Self
pub fn new(request_id: RequestId, payload: ResponsePayload) -> Self
Creates a new response.
Sourcepub fn error(request_id: RequestId, code: ErrorCode, message: String) -> Self
pub fn error(request_id: RequestId, code: ErrorCode, message: String) -> Self
Creates an error response.
Sourcepub fn to_frame(&self) -> WireResult<Frame>
pub fn to_frame(&self) -> WireResult<Frame>
Encodes the response to a frame.
Sourcepub fn from_frame(frame: &Frame) -> WireResult<Self>
pub fn from_frame(frame: &Frame) -> WireResult<Self>
Decodes a response from a frame.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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