pub struct WaitForConditionConfig<S> {
pub initial_state: S,
pub wait_strategy: Box<dyn Fn(&S, usize) -> WaitDecision + Send + Sync>,
pub timeout: Option<Duration>,
pub serdes: Option<Arc<dyn SerDesAny>>,
}Expand description
Configuration for wait_for_condition operations.
Fields§
§initial_state: SInitial state to pass to the check function.
wait_strategy: Box<dyn Fn(&S, usize) -> WaitDecision + Send + Sync>Wait strategy function that determines polling behavior.
Takes a reference to the current state and the attempt number (1-indexed),
and returns a WaitDecision.
timeout: Option<Duration>Overall timeout for the operation.
serdes: Option<Arc<dyn SerDesAny>>Optional custom serializer/deserializer.
Implementations§
Source§impl<S> WaitForConditionConfig<S>
impl<S> WaitForConditionConfig<S>
Sourcepub fn from_interval(
initial_state: S,
interval: Duration,
max_attempts: Option<usize>,
) -> Self
pub fn from_interval( initial_state: S, interval: Duration, max_attempts: Option<usize>, ) -> Self
Creates a backward-compatible WaitForConditionConfig from interval and max_attempts.
This constructor converts the old-style interval + max_attempts parameters
into a wait strategy that uses a fixed delay (no backoff, no jitter).
§Arguments
initial_state- Initial state to pass to the check function.interval- Fixed interval between condition checks.max_attempts- Maximum number of attempts (Nonefor unlimited).
§Example
ⓘ
use durable_execution_sdk::{WaitForConditionConfig, Duration};
let config = WaitForConditionConfig::from_interval(
my_initial_state,
Duration::from_seconds(5),
Some(10),
);Trait Implementations§
Source§impl<S> Debug for WaitForConditionConfig<S>where
S: Debug,
impl<S> Debug for WaitForConditionConfig<S>where
S: Debug,
Auto Trait Implementations§
impl<S> Freeze for WaitForConditionConfig<S>where
S: Freeze,
impl<S> !RefUnwindSafe for WaitForConditionConfig<S>
impl<S> Send for WaitForConditionConfig<S>where
S: Send,
impl<S> Sync for WaitForConditionConfig<S>where
S: Sync,
impl<S> Unpin for WaitForConditionConfig<S>where
S: Unpin,
impl<S> UnsafeUnpin for WaitForConditionConfig<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for WaitForConditionConfig<S>
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.