Result<T, E> — success / failure union for fallible operations. More...
#include <cstddef>#include <new>#include <type_traits>#include <utility>Go to the source code of this file.
Classes | |
| struct | pulp::runtime::detail::OkTag< T > |
| struct | pulp::runtime::detail::ErrTag< E > |
| class | pulp::runtime::Ok< T > |
| Wrap a value as a success result. More... | |
| class | pulp::runtime::Err< E > |
| Wrap a value as a failure result. More... | |
| class | pulp::runtime::Result< T, E > |
| Result<T, E> — either holds a T or an E, never both. More... | |
| class | pulp::runtime::Result< void, E > |
| Result<void, E> — an operation that either succeeded or failed with E. More... | |
Namespaces | |
| namespace | pulp |
| namespace | pulp::runtime |
| namespace | pulp::runtime::detail |
Functions | |
| template<typename T> | |
| pulp::runtime::Ok (T) -> Ok< T > | |
| template<typename E> | |
| pulp::runtime::Err (E) -> Err< E > | |
Result<T, E> — success / failure union for fallible operations.
Dependency-free placeholder until std::expected (C++23) is available across all target toolchains. The shape is intentionally API-compatible with std::expected so callers can migrate mechanically (Ok / Err map to T / unexpected<E>).
Why not just adopt std::expected today? Pulp's stable toolchain matrix still includes platforms whose stdlib lacks <expected> (or has it only behind a feature flag); shipping pulp::runtime::Result gives the codebase a single typed return surface today without blocking on the per-platform <expected> rollout.
Headless-friendly. Header-only. No allocations beyond the cost of constructing T or E. RT-callable as long as T and E are.