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 >
 
struct  pw::async2::UnwrapPoll< T >
 
struct  pw::async2::UnwrapPoll< Poll< T > >
 

Macros

#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< 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

 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.
 

Macro Definition Documentation

◆ 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 = ReadyType>
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*()

template<typename T = ReadyType>
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->()

template<typename T = ReadyType>
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==()

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 = ReadyType>
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 = ReadyType>
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()

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

Returns the inner value.

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