Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Functions
awaiters.hpp File Reference

Utilities for awaiting on Async<T>: co_await overload, all(), try_await(). More...

#include "async.hpp"
#include "buffers.hpp"
#include <array>
#include <concepts>
#include <coroutine>
#include <functional>
#include <memory>
#include <optional>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for awaiters.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  uni20::async::AllAwaiter< Aw >
 Awaitable that waits for all provided awaiters to complete. More...
 
struct  uni20::async::TryAwaiter< Awt >
 Awaiter wrapper that returns an optional result. More...
 
struct  uni20::async::ValueAwaiter< T >
 Always-ready awaitable owning an immediate operation value. More...
 

Namespaces

namespace  uni20
 
namespace  uni20::async
 This represents the reverse-mode adjoint for functions of complex variables, assuming a real-valued scalar loss function ( L \colon \mathbb{C} \to \mathbb{R} ).
 

Concepts

concept  uni20::async::HasMemberCoAwait
 Detects if T has a member operator co_await().
 
concept  uni20::async::HasFreeCoAwait
 Detects if a free operator co_await(t) exists.
 

Functions

template<TaskFactoryChildAwaitable... Aw>
requires ((!std::is_void_v<decltype(std::declval<Aw>().await_resume())> && ...))
auto uni20::async::all (Aw &&... aw) noexcept
 Build an awaitable that waits for all of the provided awaitables.
 
template<typename U >
decltype(auto) uni20::async::get_awaiter (U &&u) noexcept
 for an awaitable a, return the actual Awaitable object returned by co_await
 
template<typename T >
requires detail::AsyncReadProvider<T>
decltype(auto) uni20::async::read (T &&value)
 Obtain the read awaiter exposed by an async-like value.
 
template<typename T >
requires (!detail::AsyncReadProvider<T>)
auto uni20::async::read (T &&value) -> ValueAwaiter< std::remove_cvref_t< T > >
 Wrap an immediate value in an always-ready read awaiter.
 
template<typename Aw >
constexpr auto uni20::async::try_await (Aw &&aw) noexcept
 Build a non-blocking awaiter from an rvalue awaitable.
 
template<typename Aw >
constexpr auto uni20::async::try_await (Aw &aw) noexcept
 Build a non-blocking awaiter that returns optional<T> instead of suspending.
 
template<typename T , typename Value >
auto uni20::async::write_to (WriteBuffer< T > &&buffer, Value value)
 Create a coroutine awaiter that writes a value to a WriteBuffer<T>.
 

Detailed Description

Utilities for awaiting on Async<T>: co_await overload, all(), try_await().