Skip to main content

ActivityHandle

Struct ActivityHandle 

Source
pub struct ActivityHandle<ClientT, ActivityT>
where ActivityT: ActivityDefinition,
{ /* private fields */ }
Expand description

Handle associated with a standalone activity execution that can be used to wait for the result or to manage execution of the activity. Obtained from Client::start_activity or Client::get_activity_handle.

If run_id is set, the handle always targets that specific execution. If run_id is None, each method call targets the latest run of the specified activity_id at the time the method is called - this means consecutive method calls may target different executions if an activity was started again with the same ID.

Implementations§

Source§

impl<ClientT, ActivityT> ActivityHandle<ClientT, ActivityT>
where ActivityT: ActivityDefinition,

Source

pub fn activity_id(&self) -> &str

Activity ID this handle is associated with.

Source

pub fn run_id(&self) -> Option<&str>

Run ID of the activity execution this handle is associated with. If None, each method call targets the latest run of the specified activity_id at the time the method is called - this means consecutive method calls may target different executions if an activity was started again with the same ID.

Source§

impl<ClientT, ActivityT> ActivityHandle<ClientT, ActivityT>

Source

pub async fn result(&self) -> Result<ActivityT::Output, ActivityResultError>

Wait for the activity to complete and fetch its result. If the activity was not successful (e.g. failed, canceled, timed out), this method returns ActivityResultError::ActivityFailed.

Source

pub async fn describe( &self, options: ActivityDescribeOptions, ) -> Result<ActivityExecutionDescription<ActivityT>, ActivityInteractionError>

Describes the current state of the activity execution.

Source

pub async fn cancel( &self, options: ActivityCancelOptions, ) -> Result<(), ActivityInteractionError>

Requests cancellation of the activity. Does not wait for the cancellation to complete.

Source

pub async fn terminate( &self, options: ActivityTerminateOptions, ) -> Result<(), ActivityInteractionError>

Terminates activity execution.

Auto Trait Implementations§

§

impl<ClientT, ActivityT> Freeze for ActivityHandle<ClientT, ActivityT>
where ClientT: Freeze,

§

impl<ClientT, ActivityT> RefUnwindSafe for ActivityHandle<ClientT, ActivityT>
where ClientT: RefUnwindSafe, ActivityT: RefUnwindSafe,

§

impl<ClientT, ActivityT> Send for ActivityHandle<ClientT, ActivityT>
where ClientT: Send, ActivityT: Send,

§

impl<ClientT, ActivityT> Sync for ActivityHandle<ClientT, ActivityT>
where ClientT: Sync, ActivityT: Sync,

§

impl<ClientT, ActivityT> Unpin for ActivityHandle<ClientT, ActivityT>
where ClientT: Unpin, ActivityT: Unpin,

§

impl<ClientT, ActivityT> UnsafeUnpin for ActivityHandle<ClientT, ActivityT>
where ClientT: UnsafeUnpin,

§

impl<ClientT, ActivityT> UnwindSafe for ActivityHandle<ClientT, ActivityT>
where ClientT: UnwindSafe, ActivityT: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more