Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::runtime::Result< void, E > Class Template Reference

Result<void, E> — an operation that either succeeded or failed with E. More...

#include <result.hpp>

Public Types

using value_type = void
using error_type = E

Public Member Functions

 Result () noexcept
 Success.
 Result (Err< E > err)
 Result (const Result &other)
 Result (Result &&other) noexcept(std::is_nothrow_move_constructible_v< E >)
Result & operator= (const Result &other)
Result & operator= (Result &&other) noexcept(std::is_nothrow_move_constructible_v< E >)
 ~Result ()
bool has_value () const noexcept
 operator bool () const noexcept
bool is_err () const noexcept
void value () const noexcept
 Present so generic code can call value() uniformly.
E & error () &
const E & error () const &
E && error () &&
void & operator* () &
void * operator-> ()
void value_or (U &&fallback) const &
 Return the held value, or fallback when this is an error.

Detailed Description

template<typename E>
class pulp::runtime::Result< void, E >

Result<void, E> — an operation that either succeeded or failed with E.

The primary template stores T and E in a union, and a union cannot hold void, so "succeeded, with nothing to hand back" needs its own specialization rather than a placeholder type. std::expected<void, E> exists for the same reason.

A default-constructed Result<void, E> is the SUCCESS state, which is what makes return {}; read as "fine" at a call site. Failure is still return Err(...);, so both forms match the primary template.

Member Typedef Documentation

◆ error_type

template<typename E>
using pulp::runtime::Result< void, E >::error_type = E

◆ value_type

template<typename E>
using pulp::runtime::Result< void, E >::value_type = void

Constructor & Destructor Documentation

◆ Result() [1/4]

template<typename E>
pulp::runtime::Result< void, E >::Result ( )
inlinenoexcept

Success.

◆ Result() [2/4]

template<typename E>
pulp::runtime::Result< void, E >::Result ( Err< E > err)
inline

◆ Result() [3/4]

template<typename E>
pulp::runtime::Result< void, E >::Result ( const Result< void, E > & other)
inline

◆ Result() [4/4]

template<typename E>
pulp::runtime::Result< void, E >::Result ( Result< void, E > && other)
inlinenoexcept

◆ ~Result()

template<typename E>
pulp::runtime::Result< void, E >::~Result ( )
inline

Member Function Documentation

◆ error() [1/3]

template<typename E>
E & pulp::runtime::Result< void, E >::error ( ) &
inline

◆ error() [2/3]

template<typename E>
E && pulp::runtime::Result< void, E >::error ( ) &&
inline

◆ error() [3/3]

template<typename E>
const E & pulp::runtime::Result< void, E >::error ( ) const &
inline

◆ has_value()

template<typename E>
bool pulp::runtime::Result< void, E >::has_value ( ) const
inlinenoexcept

◆ is_err()

template<typename E>
bool pulp::runtime::Result< void, E >::is_err ( ) const
inlinenoexcept

◆ operator bool()

template<typename E>
pulp::runtime::Result< void, E >::operator bool ( ) const
inlineexplicitnoexcept

◆ operator*()

void & pulp::runtime::Result< void, E >::operator* ( ) &
inline

◆ operator->()

void * pulp::runtime::Result< void, E >::operator-> ( )
inline

◆ operator=() [1/2]

template<typename E>
Result & pulp::runtime::Result< void, E >::operator= ( const Result< void, E > & other)
inline

◆ operator=() [2/2]

template<typename E>
Result & pulp::runtime::Result< void, E >::operator= ( Result< void, E > && other)
inlinenoexcept

◆ value()

template<typename E>
void pulp::runtime::Result< void, E >::value ( ) const
inlinenoexcept

Present so generic code can call value() uniformly.

There is nothing to return; calling it on an error result is UB, as in the primary template.

◆ value_or()

void pulp::runtime::Result< void, E >::value_or ( U && fallback) const &
inline

Return the held value, or fallback when this is an error.

Member Data Documentation

◆ error_

template<typename E>
E pulp::runtime::Result< void, E >::error_

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/result.hpp