pub struct ActivityContext { /* private fields */ }Expand description
Handler-facing context for one activity execution.
Implementations§
Source§impl ActivityContext
impl ActivityContext
Sourcepub fn new(
activity_id: ActivityId,
attempt: u32,
) -> (Self, ActivityCancellationHandle)
pub fn new( activity_id: ActivityId, attempt: u32, ) -> (Self, ActivityCancellationHandle)
Creates a context and the internal handle that can signal cancellation.
Sourcepub const fn activity_id(&self) -> &ActivityId
pub const fn activity_id(&self) -> &ActivityId
Returns this activity’s identifier.
Sourcepub fn heartbeat(&self, detail: Option<Payload>) -> Result<(), WorkerError>
pub fn heartbeat(&self, detail: Option<Payload>) -> Result<(), WorkerError>
Emits a cooperative heartbeat request for this activity.
Only explicit handler calls enqueue heartbeats. Contexts created without a live heartbeat sender remain no-op contexts for isolated unit tests.
§Errors
Returns WorkerError when an installed heartbeat seam has been closed
or when the context lacks the workflow id required by the live session.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns true once cooperative cancellation has been signalled.
Trait Implementations§
Source§impl Clone for ActivityContext
impl Clone for ActivityContext
Source§fn clone(&self) -> ActivityContext
fn clone(&self) -> ActivityContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ActivityContext
impl RefUnwindSafe for ActivityContext
impl Send for ActivityContext
impl Sync for ActivityContext
impl Unpin for ActivityContext
impl UnsafeUnpin for ActivityContext
impl UnwindSafe for ActivityContext
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request