#[non_exhaustive]pub struct WorkflowContext {
pub workflow_id: String,
pub request_id: Option<String>,
pub actor: Option<String>,
pub surface: Option<String>,
}Expand description
Correlation context for workflow-scoped operations.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.workflow_id: StringStable workflow identifier shared across related events.
request_id: Option<String>Optional request identifier from an API or RPC boundary.
actor: Option<String>Optional actor name such as a user, service account, or agent.
surface: Option<String>Optional originating surface such as cli, api, web, or mcp.
Implementations§
Source§impl WorkflowContext
impl WorkflowContext
Sourcepub fn new(workflow_id: impl Into<String>) -> Result<Self, EventValidationError>
pub fn new(workflow_id: impl Into<String>) -> Result<Self, EventValidationError>
Create a workflow context with the required workflow identifier.
§Errors
Returns an error if the operation fails.
Sourcepub fn with_request_id(self, request_id: impl Into<String>) -> Self
pub fn with_request_id(self, request_id: impl Into<String>) -> Self
Attach a request identifier.
Sourcepub fn with_actor(self, actor: impl Into<String>) -> Self
pub fn with_actor(self, actor: impl Into<String>) -> Self
Attach an actor label.
Sourcepub fn with_surface(self, surface: impl Into<String>) -> Self
pub fn with_surface(self, surface: impl Into<String>) -> Self
Attach an originating surface label.
Trait Implementations§
Source§impl Clone for WorkflowContext
impl Clone for WorkflowContext
Source§impl Debug for WorkflowContext
impl Debug for WorkflowContext
Source§impl<'de> Deserialize<'de> for WorkflowContext
impl<'de> Deserialize<'de> for WorkflowContext
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 Eq for WorkflowContext
Source§impl PartialEq for WorkflowContext
impl PartialEq for WorkflowContext
Source§impl Serialize for WorkflowContext
impl Serialize for WorkflowContext
impl StructuralPartialEq for WorkflowContext
Auto Trait Implementations§
impl Forget for WorkflowContext
impl Freeze for WorkflowContext
impl RefUnwindSafe for WorkflowContext
impl Send for WorkflowContext
impl Sync for WorkflowContext
impl Unpin for WorkflowContext
impl UnsafeUnpin for WorkflowContext
impl UnwindSafe for WorkflowContext
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.