YOrch 1.0.0
Loading...
Searching...
No Matches
yorch::catch_failure_with_policy_task< Task, Policy > Struct Template Reference

Exception-catching adapter for tasks with a user-supplied fallback policy. More...

#include <catch_as_failure.hpp>

Inheritance diagram for yorch::catch_failure_with_policy_task< Task, Policy >:
Collaboration diagram for yorch::catch_failure_with_policy_task< Task, Policy >:

Public Member Functions

constexpr catch_failure_with_policy_task (Task &&stored_task, Policy &&stored_policy) noexcept(std::is_nothrow_move_constructible_v< Task > &&std::is_nothrow_move_constructible_v< Policy >)
 
constexpr catch_failure_with_policy_task (const Task &stored_task, const Policy &stored_policy) noexcept(std::is_nothrow_copy_constructible_v< Task > &&std::is_nothrow_copy_constructible_v< Policy >)
 
template<typename Ctx , typename Prev >
requires catch_policy_compatible_task<Task, Policy, Ctx, Prev>
constexpr auto invoke_raw (exec_context< Ctx, Prev > &ec) noexcept
 Executes the wrapped task and delegates exception handling to the stored fallback policy.
 
template<typename Ctx , typename Prev , typename U = Task>
requires catch_policy_compatible_direct_output_task<U, Policy, Ctx, Prev>
constexpr step_result invoke_into (exec_context< Ctx, Prev > &ec, direct_out< detail::declared_task_output_t< U > > out) noexcept
 

Public Attributes

Task task
 
Policy policy
 

Detailed Description

template<typename Task, typename Policy>
struct yorch::catch_failure_with_policy_task< Task, Policy >

Exception-catching adapter for tasks with a user-supplied fallback policy.

The policy must be noexcept and support a captured exception either by value (std::exception_ptr) or by const lvalue reference (const std::exception_ptr&), allowing the wrapper to present a noexcept invoke_raw(...) surface to the executor while still giving users control over failure-path raw results.

Template Parameters
TaskStored task type.
PolicyStored fallback policy type.

Definition at line 91 of file catch_as_failure.hpp.

Constructor & Destructor Documentation

◆ catch_failure_with_policy_task() [1/2]

template<typename Task , typename Policy >
constexpr yorch::catch_failure_with_policy_task< Task, Policy >::catch_failure_with_policy_task ( Task &&  stored_task,
Policy &&  stored_policy 
)
inlineconstexprnoexcept

Definition at line 98 of file catch_as_failure.hpp.

◆ catch_failure_with_policy_task() [2/2]

template<typename Task , typename Policy >
constexpr yorch::catch_failure_with_policy_task< Task, Policy >::catch_failure_with_policy_task ( const Task &  stored_task,
const Policy &  stored_policy 
)
inlineconstexprnoexcept

Definition at line 104 of file catch_as_failure.hpp.

Member Function Documentation

◆ invoke_into()

template<typename Task , typename Policy >
template<typename Ctx , typename Prev , typename U = Task>
requires catch_policy_compatible_direct_output_task<U, Policy, Ctx, Prev>
constexpr step_result yorch::catch_failure_with_policy_task< Task, Policy >::invoke_into ( exec_context< Ctx, Prev > &  ec,
direct_out< detail::declared_task_output_t< U > >  out 
)
inlineconstexprnoexcept

Definition at line 144 of file catch_as_failure.hpp.

◆ invoke_raw()

template<typename Task , typename Policy >
template<typename Ctx , typename Prev >
requires catch_policy_compatible_task<Task, Policy, Ctx, Prev>
constexpr auto yorch::catch_failure_with_policy_task< Task, Policy >::invoke_raw ( exec_context< Ctx, Prev > &  ec)
inlineconstexprnoexcept

Executes the wrapped task and delegates exception handling to the stored fallback policy.

Template Parameters
CtxContext schema.
PrevDirect-parent slot view type.
Parameters
ecBorrowed execution context.
Returns
The wrapped task's raw result on success, or the policy-produced raw result on exception.

Definition at line 122 of file catch_as_failure.hpp.

Member Data Documentation

◆ policy

template<typename Task , typename Policy >
Policy yorch::catch_failure_with_policy_task< Task, Policy >::policy

Definition at line 96 of file catch_as_failure.hpp.

◆ task

template<typename Task , typename Policy >
Task yorch::catch_failure_with_policy_task< Task, Policy >::task

Definition at line 95 of file catch_as_failure.hpp.


The documentation for this struct was generated from the following file: