dex_sdk/step_execution.rs
1// Copyright (c) 2026 Super Durable, Inc.
2//
3// Licensed under the Sustainable Use License 1.0.
4// You may not use this file except in compliance with the License.
5// See the LICENSE file in the repository root.
6//
7// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
8
9use crate::Step;
10
11#[derive(Clone, Debug, Eq, PartialEq)]
12/// Identifies one execution of a Step type within a Flow run.
13///
14/// Execution numbers are one-based and default to `1`.
15pub struct StepExecutionId {
16 pub(crate) step_type: &'static str,
17 pub(crate) execution_number: u32,
18}
19
20impl StepExecutionId {
21 /// Targets the first execution of `step`.
22 pub fn of<SomeStep: Step>(step: &SomeStep) -> Self {
23 Self {
24 step_type: step.step_type(),
25 execution_number: 1,
26 }
27 }
28
29 /// Selects a one-based execution number for repeated Step executions.
30 pub fn execution_number(mut self, execution_number: u32) -> Self {
31 self.execution_number = execution_number;
32 self
33 }
34}