pub struct DataResponseEnvelope { /* private fields */ }Expand description
A historical payload and the completion state of its root request.
A terminal envelope can omit its payload, including when a request fails before returning data.
sub_correlation_id identifies a source child without changing the root correlation ID.
Implementations§
Source§impl DataResponseEnvelope
impl DataResponseEnvelope
Sourcepub fn new(
response: DataResponse,
completed: bool,
sub_correlation_id: Option<UUID4>,
) -> Self
pub fn new( response: DataResponse, completed: bool, sub_correlation_id: Option<UUID4>, ) -> Self
Creates an envelope containing a payload.
Sourcepub fn terminal(correlation_id: UUID4, failure_reason: Option<String>) -> Self
pub fn terminal(correlation_id: UUID4, failure_reason: Option<String>) -> Self
Completes a request without a payload. A reason marks the request as failed.
Sourcepub fn with_correlation_id(self, correlation_id: UUID4) -> Self
pub fn with_correlation_id(self, correlation_id: UUID4) -> Self
Sets the root request ID while preserving the payload correlation ID.
Sourcepub fn with_failure(self, reason: String) -> Self
pub fn with_failure(self, reason: String) -> Self
Completes a failed request while preserving the payload returned by successful work.
pub const fn correlation_id(&self) -> &UUID4
pub const fn response(&self) -> Option<&DataResponse>
Sourcepub const fn response_mut(&mut self) -> Option<&mut DataResponse>
pub const fn response_mut(&mut self) -> Option<&mut DataResponse>
Returns the payload for in-place metadata updates or bounds trimming.
pub const fn completed(&self) -> bool
pub const fn sub_correlation_id(&self) -> Option<UUID4>
pub fn failure_reason(&self) -> Option<&str>
Trait Implementations§
Source§impl Clone for DataResponseEnvelope
impl Clone for DataResponseEnvelope
Source§impl Debug for DataResponseEnvelope
impl Debug for DataResponseEnvelope
Source§impl<'de> Deserialize<'de> for DataResponseEnvelope
impl<'de> Deserialize<'de> for DataResponseEnvelope
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for DataResponseEnvelope
impl !UnwindSafe for DataResponseEnvelope
impl Freeze for DataResponseEnvelope
impl Send for DataResponseEnvelope
impl Sync for DataResponseEnvelope
impl Unpin for DataResponseEnvelope
impl UnsafeUnpin for DataResponseEnvelope
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