Skip to main content

temporalio_common/
activity_definition.rs

1//! Contains types for activity definitions, used by the code generated by the macros for defining
2//! activities, or directly by users targeting activities in other languages.
3
4use crate::data_converters::{TemporalDeserializable, TemporalSerializable};
5
6/// Implement on a marker struct to define an activity.
7///
8/// Typically, you will want to use the `#[activity]` attribute within an `#[activities]` macro to
9/// define activities. However, this trait may be implemented manually if desired.
10pub trait ActivityDefinition {
11    /// Type of the input argument to the workflow
12    type Input: TemporalDeserializable + TemporalSerializable + 'static;
13    /// Type of the output of the workflow
14    type Output: TemporalDeserializable + TemporalSerializable + 'static;
15
16    /// The name that will be used for the activity type.
17    fn name() -> &'static str
18    where
19        Self: Sized;
20}