C/C++ API Reference
Loading...
Searching...
No Matches

Overview

Statuses for asynchronous operations.

Classes

struct  pw::async2::ReadyType
 
struct  pw::async2::PendingType
 
class  pw::async2::Poll< T >
 
class  pw::async2::Poll< void >
 
struct  pw::async2::UnwrapPoll< T >
 
struct  pw::async2::UnwrapPoll< Poll< T > >
 

Macros

#define PW_ASYNC2_POLL_NODISCARD
 
#define PW_TRY_READY(expr)
 Returns Poll::Pending() if expr is Poll::Pending().
 
#define PW_TRY_READY_ASSIGN(lhs, expression)    _PW_TRY_READY_ASSIGN(_PW_TRY_READY_UNIQUE(__LINE__), lhs, expression)
 

Typedefs

using pw::async2::Poll< void >::value_type = void
 
using pw::async2::Poll< T >::value_type = T
 
template<typename T >
using pw::async2::PollResult = Poll< Result< T > >
 Convenience alias for pw::async2::Poll<pw::Result<T>>.
 
template<typename T >
using pw::async2::PollOptional = Poll< std::optional< T > >
 Convenience alias for Poll<std::optional>.
 
using pw::async2::UnwrapPoll< T >::Type = T
 
using pw::async2::UnwrapPoll< Poll< T > >::Type = T
 

Functions

constexpr pw::async2::Poll< void >::Poll (const Poll &)=default
 
constexpr Pollpw::async2::Poll< void >::operator= (const Poll &)=default
 
constexpr pw::async2::Poll< void >::Poll (Poll &&)=default
 
constexpr Pollpw::async2::Poll< void >::operator= (Poll &&)=default
 
constexpr pw::async2::Poll< void >::Poll (std::in_place_t)
 
constexpr pw::async2::Poll< void >::Poll (std::in_place_t, ReadyType)
 
constexpr pw::async2::Poll< void >::Poll (ReadyType)
 
constexpr Pollpw::async2::Poll< void >::operator= (ReadyType)
 
constexpr pw::async2::Poll< void >::Poll (PendingType)
 
constexpr Pollpw::async2::Poll< void >::operator= (PendingType)
 
constexpr bool pw::async2::Poll< void >::IsReady () const noexcept
 
constexpr bool pw::async2::Poll< void >::IsPending () const noexcept
 
constexpr Poll pw::async2::Poll< void >::Readiness () const noexcept
 
constexpr ReadyTypepw::async2::Poll< void >::value () noexcept
 Returns a ReadyType for compatibility with non-void Poll.
 
constexpr const ReadyTypepw::async2::Poll< void >::value () const noexcept
 Returns a ReadyType for compatibility with non-void Poll.
 
constexpr const ReadyTypepw::async2::Poll< void >::operator-> () const noexcept
 Returns a ReadyType for compatibility with non-void Poll.
 
constexpr ReadyTypepw::async2::Poll< void >::operator-> () noexcept
 Returns a ReadyType for compatibility with non-void Poll.
 
constexpr const ReadyTypepw::async2::Poll< void >::operator* () const noexcept
 Returns a ReadyType for compatibility with non-void Poll.
 
constexpr ReadyTypepw::async2::Poll< void >::operator* () noexcept
 Returns a ReadyType for compatibility with non-void Poll.
 
constexpr void pw::async2::Poll< void >::IgnorePoll () const
 
 pw::async2::Poll< T >::Poll ()=delete
 Basic constructors.
 
constexpr pw::async2::Poll< T >::Poll (const Poll &)=default
 
constexpr Pollpw::async2::Poll< T >::operator= (const Poll &)=default
 
constexpr pw::async2::Poll< T >::Poll (Poll &&)=default
 
constexpr Pollpw::async2::Poll< T >::operator= (Poll &&)=default
 
template<typename U , internal_poll::EnableIfImplicitlyConvertible< value_type, const U & > = 0>
constexpr pw::async2::Poll< T >::Poll (const Poll< U > &other)
 
template<typename U , internal_poll::EnableIfImplicitlyConvertible< value_type, U && > = 0>
constexpr pw::async2::Poll< T >::Poll (Poll< U > &&other)
 
template<typename U = value_type, internal_poll::EnableIfImplicitlyInitializable< value_type, U > = 0>
constexpr pw::async2::Poll< T >::Poll (U &&u)
 
template<typename... Args>
constexpr pw::async2::Poll< T >::Poll (std::in_place_t, Args &&... args)
 
constexpr pw::async2::Poll< T >::Poll (value_type &&value)
 
constexpr Pollpw::async2::Poll< T >::operator= (value_type &&value)
 
constexpr pw::async2::Poll< T >::Poll (PendingType) noexcept
 
constexpr Pollpw::async2::Poll< T >::operator= (PendingType) noexcept
 
constexpr bool pw::async2::Poll< T >::IsReady () const noexcept
 Returns whether or not this value is Ready.
 
constexpr bool pw::async2::Poll< T >::IsPending () const noexcept
 Returns whether or not this value is Pending.
 
constexpr Poll pw::async2::Poll< T >::Readiness () const noexcept
 
constexpr value_type & pw::async2::Poll< T >::value () &noexcept
 
constexpr const value_type & pw::async2::Poll< T >::value () const &noexcept
 
constexpr value_type && pw::async2::Poll< T >::value () &&noexcept
 
constexpr const value_type && pw::async2::Poll< T >::value () const &&noexcept
 
constexpr const value_type * pw::async2::Poll< T >::operator-> () const noexcept
 
constexpr value_type * pw::async2::Poll< T >::operator-> () noexcept
 
constexpr const value_type & pw::async2::Poll< T >::operator* () const &noexcept
 
constexpr value_type & pw::async2::Poll< T >::operator* () &noexcept
 
constexpr const value_type && pw::async2::Poll< T >::operator* () const &&noexcept
 
constexpr value_type && pw::async2::Poll< T >::operator* () &&noexcept
 
constexpr void pw::async2::Poll< T >::IgnorePoll () const
 
template<typename T >
 pw::async2::Poll (T value) -> Poll< T >
 
template<typename T >
constexpr bool pw::async2::operator== (const Poll< T > &lhs, const Poll< T > &rhs)
 
template<typename T >
constexpr bool pw::async2::operator!= (const Poll< T > &lhs, const Poll< T > &rhs)
 
template<typename T >
constexpr bool pw::async2::operator== (const Poll< T > &lhs, PendingType)
 Returns whether lhs is pending.
 
template<typename T >
constexpr bool pw::async2::operator!= (const Poll< T > &lhs, PendingType)
 Returns whether lhs is not pending.
 
template<typename T >
constexpr bool pw::async2::operator== (PendingType, const Poll< T > &rhs)
 Returns whether rhs is pending.
 
template<typename T >
constexpr bool pw::async2::operator!= (PendingType, const Poll< T > &rhs)
 Returns whether rhs is not pending.
 
constexpr bool pw::async2::operator== (ReadyType, ReadyType)
 
constexpr bool pw::async2::operator!= (ReadyType, ReadyType)
 
constexpr bool pw::async2::operator== (PendingType, PendingType)
 
constexpr bool pw::async2::operator!= (PendingType, PendingType)
 
constexpr Poll pw::async2::Ready ()
 Returns a value indicating completion.
 
template<typename T , typename... Args>
constexpr Poll< T > pw::async2::Ready (std::in_place_t, Args &&... args)
 
template<typename T >
constexpr Poll< std::remove_reference_t< T > > pw::async2::Ready (T &&value)
 Returns a value indicating completion with some result.
 
constexpr PendingType pw::async2::Pending ()
 Returns a value indicating that an operation was not yet able to complete.
 

Friends

constexpr bool pw::async2::Poll< void >::operator== (const Poll &lhs, const Poll &rhs)
 
constexpr bool pw::async2::Poll< void >::operator!= (const Poll &lhs, const Poll &rhs)
 

Macro Definition Documentation

◆ PW_ASYNC2_POLL_NODISCARD

#define PW_ASYNC2_POLL_NODISCARD
Value:
"`Poll`-returning functions may or may not have completed. Their " \
"return value should be examined.")
#define PW_NODISCARD_STR(str)
Definition: language_feature_macros.h:61

◆ PW_TRY_READY

#define PW_TRY_READY (   expr)
Value:
do { \
if ((expr).IsPending()) { \
return ::pw::async2::Pending(); \
} \
} while (0)

Returns Poll::Pending() if expr is Poll::Pending().

◆ PW_TRY_READY_ASSIGN

#define PW_TRY_READY_ASSIGN (   lhs,
  expression 
)     _PW_TRY_READY_ASSIGN(_PW_TRY_READY_UNIQUE(__LINE__), lhs, expression)

Returns Poll::Pending() if expr is Poll::Pending(). If expression is Poll::Ready(), assigns the inner value to lhs.

Function Documentation

◆ IgnorePoll()

template<typename T >
constexpr void pw::async2::Poll< T >::IgnorePoll ( ) const
inlineconstexpr

Ignores the Poll value.

This method does nothing except prevent no_discard or unused variable warnings from firing.

◆ operator!=()

template<typename T >
constexpr bool pw::async2::operator!= ( const Poll< T > &  lhs,
const Poll< T > &  rhs 
)
constexpr

Returns whether two instances of Poll<T> are unequal.

Note that this comparison operator will return false if both values are currently Pending, even if the eventual results of each operation might differ.

◆ operator*() [1/3]

template<typename T >
constexpr const value_type & pw::async2::Poll< T >::operator* ( ) const &
inlineconstexprnoexcept

Returns the inner value.

This must only be called if IsReady() returned true.

◆ operator*() [2/3]

constexpr const ReadyType & pw::async2::Poll< void >::operator* ( ) const
inlineconstexprnoexcept

Returns a ReadyType for compatibility with non-void Poll.

◆ operator*() [3/3]

constexpr ReadyType & pw::async2::Poll< void >::operator* ( )
inlineconstexprnoexcept

Returns a ReadyType for compatibility with non-void Poll.

◆ operator->() [1/3]

constexpr const ReadyType * pw::async2::Poll< void >::operator-> ( ) const
inlineconstexprnoexcept

Returns a ReadyType for compatibility with non-void Poll.

◆ operator->() [2/3]

template<typename T >
constexpr const value_type * pw::async2::Poll< T >::operator-> ( ) const
inlineconstexprnoexcept

Accesses the inner value.

This must only be called if IsReady() returned true.

◆ operator->() [3/3]

constexpr ReadyType * pw::async2::Poll< void >::operator-> ( )
inlineconstexprnoexcept

Returns a ReadyType for compatibility with non-void Poll.

◆ operator==()

template<typename T >
constexpr bool pw::async2::operator== ( const Poll< T > &  lhs,
const Poll< T > &  rhs 
)
constexpr

Returns whether two instances of Poll<T> are equal.

Note that this comparison operator will return true if both values are currently Pending, even if the eventual results of each operation might differ.

◆ Poll()

template<typename T >
template<typename U , internal_poll::EnableIfImplicitlyConvertible< value_type, const U & > = 0>
constexpr pw::async2::Poll< T >::Poll ( const Poll< U > &  other)
inlineconstexpr

Constructs a new Poll<T> from a Poll<U> where T is constructible from U.

To avoid ambiguity, this constructor is disabled if T is also constructible from Poll<U>.

This constructor is explicit if and only if the corresponding construction of T from U is explicit.

◆ Readiness()

template<typename T >
constexpr Poll pw::async2::Poll< T >::Readiness ( ) const
inlineconstexprnoexcept

Returns a Poll<> without the inner value whose readiness matches that of this.

◆ Ready()

template<typename T , typename... Args>
constexpr Poll< T > pw::async2::Ready ( std::in_place_t  ,
Args &&...  args 
)
constexpr

Returns a value indicating completion with some result (constructed in-place).

◆ value() [1/2]

template<typename T >
constexpr value_type & pw::async2::Poll< T >::value ( ) &
inlineconstexprnoexcept

Returns the inner value.

This must only be called if IsReady() returned true.

◆ value() [2/2]

constexpr const ReadyType & pw::async2::Poll< void >::value ( ) const
inlineconstexprnoexcept

Returns a ReadyType for compatibility with non-void Poll.

Friends

◆ operator!=

constexpr bool operator!= ( const Poll< void > &  lhs,
const Poll< void > &  rhs 
)
friend

Returns whether two instances of Poll<T> are unequal.

Note that this comparison operator will return false if both values are currently Pending, even if the eventual results of each operation might differ.

◆ operator==

constexpr bool operator== ( const Poll< void > &  lhs,
const Poll< void > &  rhs 
)
friend

Returns whether two instances of Poll<T> are equal.

Note that this comparison operator will return true if both values are currently Pending, even if the eventual results of each operation might differ.