pub struct Wait { /* private fields */ }Expand description
Describes when Dex may invoke a Step’s execute handler.
Build waits from durable timer and Channel Condition values. Combinators consume their
inputs and preserve order, which determines timer indexes used by crate::TimerId.
§Examples
use dex_sdk::{Channel, Timer, Wait};
use std::time::Duration;
let approvals = Channel::<String>::new("approvals");
let wait = Wait::any_of([
approvals.for_one(),
Timer::by_duration(Duration::from_secs(300)),
]);Implementations§
Source§impl Wait
impl Wait
Sourcepub fn skip_immediately() -> Self
pub fn skip_immediately() -> Self
Skips wait_for and asks Dex to invoke execute immediately.
Sourcepub fn until(condition: Condition) -> Self
pub fn until(condition: Condition) -> Self
Waits until one condition is satisfied. The Condition does not need an ID.
Sourcepub fn all_of(conditions: impl IntoIterator<Item = Condition>) -> Self
pub fn all_of(conditions: impl IntoIterator<Item = Condition>) -> Self
Waits until every condition is satisfied. Conditions do not need IDs.
Sourcepub fn any_of(conditions: impl IntoIterator<Item = Condition>) -> Self
pub fn any_of(conditions: impl IntoIterator<Item = Condition>) -> Self
Waits until at least one condition is satisfied. Conditions do not need IDs.
Among ready conditions, Dex selects the first in canonical order: Timers, Channels, then SubFlows, preserving iterator order within each kind. An unready condition does not block a later ready condition. To wait for strict priority, return only the higher-priority condition.
Channel consumption is not greedy across alternatives. Only the selected Channel condition consumes messages; other ready Channel conditions consume nothing.
Sourcepub fn any_combination_of(
combinations: impl IntoIterator<Item = ConditionCombination>,
) -> Self
pub fn any_combination_of( combinations: impl IntoIterator<Item = ConditionCombination>, ) -> Self
Waits for every Condition in any combination.
Channel consumption is limited to Channel conditions in the selected combination. Conditions belonging only to other ready combinations consume nothing.
Every Condition needs a non-empty user ID. Clones of the same Condition may be reused across combinations; distinct Conditions need unique IDs.
Auto Trait Implementations§
impl !RefUnwindSafe for Wait
impl !UnwindSafe for Wait
impl Freeze for Wait
impl Send for Wait
impl Sync for Wait
impl Unpin for Wait
impl UnsafeUnpin for Wait
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
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>
T in a tonic::Request