pub struct UnifiedResponse {
pub CorrelationIdentifier: CorrelationId,
pub Success: bool,
pub Payload: Vec<u8>,
pub Error: Option<ResponseError>,
pub Metadata: HashMap<String, String>,
pub GeneratedAt: Timestamp,
}Expand description
A unified response message that can be received over any transport.
Fields§
§CorrelationIdentifier: CorrelationIdCorrelation ID matching the request.
Success: boolSuccess flag indicating whether the operation completed successfully.
Payload: Vec<u8>Binary payload containing the serialized result (if Success = true).
Error: Option<ResponseError>Error information when Success = false.
Metadata: HashMap<String, String>Additional response metadata.
GeneratedAt: TimestampTimestamp when the response was generated (microseconds since Unix epoch).
Implementations§
Source§impl UnifiedResponse
impl UnifiedResponse
Sourcepub fn Success(CorrelationIdentifier: CorrelationId, Payload: Vec<u8>) -> Self
pub fn Success(CorrelationIdentifier: CorrelationId, Payload: Vec<u8>) -> Self
Creates a new successful response with the given correlation ID and payload.
Sourcepub fn Failure(
CorrelationIdentifier: CorrelationId,
Error: ResponseError,
Payload: Option<Vec<u8>>,
) -> Self
pub fn Failure( CorrelationIdentifier: CorrelationId, Error: ResponseError, Payload: Option<Vec<u8>>, ) -> Self
Creates a new error response with the given correlation ID and error.
Sourcepub fn FromTransportError(
CorrelationIdentifier: CorrelationId,
TransportError: &TransportError,
) -> Self
pub fn FromTransportError( CorrelationIdentifier: CorrelationId, TransportError: &TransportError, ) -> Self
Creates a new error response from a TransportError.
Sourcepub fn WithMetadata(
self,
Key: impl Into<String>,
Value: impl Into<String>,
) -> Self
pub fn WithMetadata( self, Key: impl Into<String>, Value: impl Into<String>, ) -> Self
Adds metadata to the response.
Sourcepub fn WithMetadataMap(self, Metadata: HashMap<String, String>) -> Self
pub fn WithMetadataMap(self, Metadata: HashMap<String, String>) -> Self
Sets the entire metadata map.
Sourcepub fn ErrorCode(&self) -> Option<TransportErrorCode>
pub fn ErrorCode(&self) -> Option<TransportErrorCode>
Gets the error code if this is an error response.
Trait Implementations§
Source§impl Clone for UnifiedResponse
impl Clone for UnifiedResponse
Source§fn clone(&self) -> UnifiedResponse
fn clone(&self) -> UnifiedResponse
Returns a duplicate 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 moreSource§impl Debug for UnifiedResponse
impl Debug for UnifiedResponse
Source§impl<'de> Deserialize<'de> for UnifiedResponse
impl<'de> Deserialize<'de> for UnifiedResponse
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
Source§impl PartialEq for UnifiedResponse
impl PartialEq for UnifiedResponse
Source§impl Serialize for UnifiedResponse
impl Serialize for UnifiedResponse
impl Eq for UnifiedResponse
impl StructuralPartialEq for UnifiedResponse
Auto Trait Implementations§
impl Freeze for UnifiedResponse
impl RefUnwindSafe for UnifiedResponse
impl Send for UnifiedResponse
impl Sync for UnifiedResponse
impl Unpin for UnifiedResponse
impl UnsafeUnpin for UnifiedResponse
impl UnwindSafe for UnifiedResponse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<'de, D, R> CommandArg<'de, R> for Dwhere
D: Deserialize<'de>,
R: Runtime,
impl<'de, D, R> CommandArg<'de, R> for Dwhere
D: Deserialize<'de>,
R: Runtime,
§fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>
fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.