pub struct Response<T> {
pub header: Header,
pub id: Id,
pub origin_id: Id,
pub payload: T,
}
Expand description
Represents a response received related to some response
Fields§
§header: Header
Optional header data to include with response
id: Id
Unique id associated with the response
origin_id: Id
Unique id associated with the response that triggered the response
payload: T
Payload associated with the response
Implementations§
Source§impl<T> Response<T>where
T: Serialize,
impl<T> Response<T>where
T: Serialize,
Sourcepub fn to_payload_vec(&self) -> Result<Vec<u8>>
pub fn to_payload_vec(&self) -> Result<Vec<u8>>
Serializes the response’s payload into bytes
Sourcepub fn to_untyped_response(&self) -> Result<UntypedResponse<'_>>
pub fn to_untyped_response(&self) -> Result<UntypedResponse<'_>>
Attempts to convert a typed response to an untyped response
Source§impl<T> Response<T>where
T: DeserializeOwned,
impl<T> Response<T>where
T: DeserializeOwned,
Sourcepub fn from_slice(slice: &[u8]) -> Result<Self>
pub fn from_slice(slice: &[u8]) -> Result<Self>
Deserializes the response from bytes
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Response<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Response<T>where
T: Deserialize<'de>,
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
impl<T: Eq> Eq for Response<T>
impl<T> StructuralPartialEq for Response<T>
Auto Trait Implementations§
impl<T> Freeze for Response<T>where
T: Freeze,
impl<T> RefUnwindSafe for Response<T>where
T: RefUnwindSafe,
impl<T> Send for Response<T>where
T: Send,
impl<T> Sync for Response<T>where
T: Sync,
impl<T> Unpin for Response<T>where
T: Unpin,
impl<T> UnwindSafe for Response<T>where
T: UnwindSafe,
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