Skip to main content

select

Macro select 

Source
macro_rules! select {
    ($($tokens:tt)*) => { ... };
}
Expand description

Deterministic select! for use in Temporal workflows.

Polls branches in declaration order (top to bottom), ensuring deterministic behavior across workflow replays. Delegates to futures_util::select_biased!.

All workflow futures (timers, activities, child workflows, etc.) implement FusedFuture, so they can be stored in variables and passed to select! without needing .fuse().

§Example

use temporalio_sdk::workflows::select;
use temporalio_sdk::WorkflowContext;
use std::time::Duration;

select! {
    _ = ctx.timer(Duration::from_secs(60)) => { /* timer fired */ }
    reason = ctx.cancelled() => { /* cancelled */ }
};