Coros declared as safe_task<Safety, T> will satisfy the strong constraints above, or fail with a compile error.

Synopsis

Declared in <folly/coro/safe/SafeTask.h>

template<
    typename T,
    typename... SafetyArgs>
using auto_safe_task = /* implementation-defined */;

Description

The safety of a coroutine template may vary depending on the args or return type, meaning that the user can't actually pick a fixed safety level for their generic coro.

Instead, the generic coro can return `auto_safe_task<ReturnT, SafetyArgs...>`, where `SafetyArgs` is (typically) the subset of the coroutine's argument types that may affect safety.

auto_safe_task has a Significant Caveat ‐‐ you can't use it with non‐`static` member functions ‐‐ the implicit object parameter is unsafe (as it should be). And if you do use it, you will get a compile‐time error instead of a now_task, simply because this type‐function has no access to the callable. See APIBestPractices.md for workarounds.

Created with MrDocs