pub struct DoubleCheckedLockReadyBuilder<L, T> { /* private fields */ }Expand description
Convenience builder state with tester attached.
Implementations§
Source§impl<L, T> DoubleCheckedLockReadyBuilder<L, T>where
L: Lock<T>,
impl<L, T> DoubleCheckedLockReadyBuilder<L, T>where
L: Lock<T>,
Sourcepub fn log_unmet_condition(
self,
level: Level,
message: impl Into<String>,
) -> Self
pub fn log_unmet_condition( self, level: Level, message: impl Into<String>, ) -> Self
Sourcepub fn disable_unmet_condition_logging(self) -> Self
pub fn disable_unmet_condition_logging(self) -> Self
Disables logging when the double-checked condition is not met.
§Returns
This builder with unmet-condition logging disabled.
Sourcepub fn log_prepare_failure(
self,
level: Level,
message_prefix: impl Into<String>,
) -> Self
pub fn log_prepare_failure( self, level: Level, message_prefix: impl Into<String>, ) -> Self
Sourcepub fn disable_prepare_failure_logging(self) -> Self
pub fn disable_prepare_failure_logging(self) -> Self
Disables logging when the prepare action fails.
§Returns
This builder with prepare failure logging disabled.
Sourcepub fn log_prepare_commit_failure(
self,
level: Level,
message_prefix: impl Into<String>,
) -> Self
pub fn log_prepare_commit_failure( self, level: Level, message_prefix: impl Into<String>, ) -> Self
Sourcepub fn disable_prepare_commit_failure_logging(self) -> Self
pub fn disable_prepare_commit_failure_logging(self) -> Self
Disables logging when the prepare commit action fails.
§Returns
This builder with prepare-commit failure logging disabled.
Sourcepub fn log_prepare_rollback_failure(
self,
level: Level,
message_prefix: impl Into<String>,
) -> Self
pub fn log_prepare_rollback_failure( self, level: Level, message_prefix: impl Into<String>, ) -> Self
Sourcepub fn disable_prepare_rollback_failure_logging(self) -> Self
pub fn disable_prepare_rollback_failure_logging(self) -> Self
Disables logging when the prepare rollback action fails.
§Returns
This builder with prepare-rollback failure logging disabled.
Sourcepub fn catch_panics(self) -> Self
pub fn catch_panics(self) -> Self
Enables panic capture for tester, prepare callbacks, and task execution.
§Returns
This builder with panic capture enabled.
Sourcepub fn with_panic_capture(self, catch_panics: bool) -> Self
pub fn with_panic_capture(self, catch_panics: bool) -> Self
Sourcepub fn disable_catch_panics(self) -> Self
pub fn disable_catch_panics(self) -> Self
Disables panic capture for tester, prepare callbacks, and task execution.
§Returns
This builder with panic capture disabled.
Sourcepub fn prepare<Rn, E>(self, prepare_action: Rn) -> Self
pub fn prepare<Rn, E>(self, prepare_action: Rn) -> Self
Sets the prepare action.
§Parameters
prepare_action- Fallible action to run after the first condition check and before locking.
§Returns
This builder with prepare configured.
§Errors
This builder method does not return errors. If prepare_action later
returns an error during execution, the execution result becomes
super::ExecutionResult::Failed with
super::ExecutorError::PrepareFailed.
Sourcepub fn rollback_prepare<Rn, E>(self, rollback_prepare_action: Rn) -> Self
pub fn rollback_prepare<Rn, E>(self, rollback_prepare_action: Rn) -> Self
Sets the rollback action for prepare.
§Parameters
rollback_prepare_action- Fallible action to run when prepare completed but the second condition check or task fails.
§Returns
This builder with prepare rollback configured.
§Errors
This builder method does not return errors. If
rollback_prepare_action later returns an error during execution, the
execution result becomes super::ExecutionResult::Failed with
super::ExecutorError::PrepareRollbackFailed.
Sourcepub fn commit_prepare<Rn, E>(self, commit_prepare_action: Rn) -> Self
pub fn commit_prepare<Rn, E>(self, commit_prepare_action: Rn) -> Self
Sets the commit action for prepare.
§Parameters
commit_prepare_action- Fallible action to run when prepare completed and the task succeeds.
§Returns
This builder with prepare commit configured.
§Errors
This builder method does not return errors. If commit_prepare_action
later returns an error during execution, the execution result becomes
super::ExecutionResult::Failed with
super::ExecutorError::PrepareCommitFailed.
Sourcepub fn build(self) -> DoubleCheckedLockExecutor<L, T>
pub fn build(self) -> DoubleCheckedLockExecutor<L, T>
Builds a reusable DoubleCheckedLockExecutor.
§Returns
A reusable executor containing the configured lock, tester, logger, and prepare lifecycle callbacks.
Sourcepub fn call<C, R, E>(self, task: C) -> ExecutionContext<R, E>
pub fn call<C, R, E>(self, task: C) -> ExecutionContext<R, E>
Runs a callable task with one-shot executor creation.
§Parameters
task- Zero-argument callable executed after both condition checks pass.
§Returns
An ExecutionContext containing success, unmet-condition, or failure
information.
Sourcepub fn execute<Rn, E>(self, task: Rn) -> ExecutionContext<(), E>
pub fn execute<Rn, E>(self, task: Rn) -> ExecutionContext<(), E>
Runs a runnable task with one-shot executor creation.
§Parameters
task- Zero-argument runnable executed after both condition checks pass.
§Returns
An ExecutionContext containing success, unmet-condition, or failure
information.
Sourcepub fn call_with<C, R, E>(self, task: C) -> ExecutionContext<R, E>where
C: CallableWith<T, R, E>,
E: Display,
pub fn call_with<C, R, E>(self, task: C) -> ExecutionContext<R, E>where
C: CallableWith<T, R, E>,
E: Display,
Runs a callable task with mutable protected data.
§Parameters
task- Callable receiving&mut Tafter both condition checks pass.
§Returns
An ExecutionContext containing success, unmet-condition, or failure
information.
Sourcepub fn execute_with<Rn, E>(self, task: Rn) -> ExecutionContext<(), E>where
Rn: RunnableWith<T, E>,
E: Display,
pub fn execute_with<Rn, E>(self, task: Rn) -> ExecutionContext<(), E>where
Rn: RunnableWith<T, E>,
E: Display,
Runs a runnable task with mutable protected data.
§Parameters
task- Runnable receiving&mut Tafter both condition checks pass.
§Returns
An ExecutionContext containing success, unmet-condition, or failure
information.
Trait Implementations§
Source§impl<L: Clone, T: Clone> Clone for DoubleCheckedLockReadyBuilder<L, T>
impl<L: Clone, T: Clone> Clone for DoubleCheckedLockReadyBuilder<L, T>
Source§fn clone(&self) -> DoubleCheckedLockReadyBuilder<L, T>
fn clone(&self) -> DoubleCheckedLockReadyBuilder<L, T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more