YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib_ext::StatusOrTrait Struct Reference

Result trait that plugs absl::StatusOr<V> into yaclib,. More...

#include <status_or.hpp>

Public Types

template<typename V >
using Result = std::conditional_t< std::is_void_v< V >, absl::Status, absl::StatusOr< V > >
 
using Error = absl::Status
 
template<typename R >
using Value = std::conditional_t< std::is_same_v< R, absl::Status >, void, typename yaclib::detail::InstantiationType< absl::StatusOr, R >::Value >
 

Static Public Member Functions

static absl::Status FromException (std::exception_ptr e) noexcept
 
template<typename V , typename... Args>
static Result< V > MakeResult (Args &&... args)
 
static bool Ok (const absl::Status &r) noexcept
 
template<typename U >
static bool Ok (const absl::StatusOr< U > &r) noexcept
 
template<typename R >
static decltype(auto) GetValue (R &&r) noexcept
 
template<typename R >
static decltype(auto) GetError (R &&r) noexcept
 
template<typename R >
static decltype(auto) Get (R &&r)
 
static bool IsStop (const absl::Status &error) noexcept
 

Detailed Description

Result trait that plugs absl::StatusOr<V> into yaclib,.

See also
yaclib::ResultTrait for the contract

Result<void> is absl::Status. Cancellation is absl::StatusCode::kCancelled. Exceptions thrown by user callbacks are converted to absl::StatusCode::kUnknown.

Definition at line 22 of file status_or.hpp.

Member Typedef Documentation

◆ Error

using yaclib_ext::StatusOrTrait::Error = absl::Status

Definition at line 26 of file status_or.hpp.

◆ Result

template<typename V >
using yaclib_ext::StatusOrTrait::Result = std::conditional_t<std::is_void_v<V>, absl::Status, absl::StatusOr<V> >

Definition at line 24 of file status_or.hpp.

◆ Value

template<typename R >
using yaclib_ext::StatusOrTrait::Value = std::conditional_t<std::is_same_v<R, absl::Status>, void, typename yaclib::detail::InstantiationType<absl::StatusOr, R>::Value>

Definition at line 29 of file status_or.hpp.

Member Function Documentation

◆ FromException()

static absl::Status yaclib_ext::StatusOrTrait::FromException ( std::exception_ptr  e)
inlinestaticnoexcept

Definition at line 32 of file status_or.hpp.

Referenced by MakeResult().

◆ Get()

template<typename R >
static decltype(auto) yaclib_ext::StatusOrTrait::Get ( R &&  r)
inlinestatic

Definition at line 99 of file status_or.hpp.

◆ GetError()

template<typename R >
static decltype(auto) yaclib_ext::StatusOrTrait::GetError ( R &&  r)
inlinestaticnoexcept

Definition at line 90 of file status_or.hpp.

◆ GetValue()

template<typename R >
static decltype(auto) yaclib_ext::StatusOrTrait::GetValue ( R &&  r)
inlinestaticnoexcept

Definition at line 81 of file status_or.hpp.

References yaclib::MakeContract().

◆ IsStop()

static bool yaclib_ext::StatusOrTrait::IsStop ( const absl::Status &  error)
inlinestaticnoexcept

Definition at line 109 of file status_or.hpp.

◆ MakeResult()

template<typename V , typename... Args>
static Result< V > yaclib_ext::StatusOrTrait::MakeResult ( Args &&...  args)
inlinestatic

Definition at line 45 of file status_or.hpp.

References FromException().

◆ Ok() [1/2]

static bool yaclib_ext::StatusOrTrait::Ok ( const absl::Status &  r)
inlinestaticnoexcept

Definition at line 72 of file status_or.hpp.

◆ Ok() [2/2]

template<typename U >
static bool yaclib_ext::StatusOrTrait::Ok ( const absl::StatusOr< U > &  r)
inlinestaticnoexcept

Definition at line 76 of file status_or.hpp.


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