pub async fn ExecuteEffect<TRunTime, TCapabilityProvider, TError, TOutput>(
RunTime: Arc<TRunTime>,
Effect: ActionEffect<Arc<TCapabilityProvider>, TError, TOutput>,
) -> Result<TOutput, TError>where
TRunTime: ApplicationRunTime,
TCapabilityProvider: ?Sized + Send + Sync + 'static,
TRunTime::EnvironmentType: Requires<TCapabilityProvider>,
TError: From<CommonError> + Send + Sync + 'static,
TOutput: Send + Sync + 'static,Expand description
A generic effect execution helper that takes a runtime and an effect, and executes the effect using that runtime.
This function provides a more concise and declarative syntax for running
effects, abstracting away the direct RunTime.Run(Effect) call and making
the intent of the code clearer.
§Example
ⓘ
async fn ReadMyFile(RunTime: Arc<impl ApplicationRunTime>) ->
Result<Vec<u8>, CommonError> {
let ReadEffect =
FileSystem::ReadFile(PathBuf::from("/path/to/file.txt"));
ExecuteEffect(RunTime, ReadEffect).await
}