Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::expected< void > Class Reference

Specialization of expected for void — used for operations that return success or error only. More...

#include <error.hpp>

Public Member Functions

 expected ()
 Construct a successful (OK) result with no payload.
 
 expected (const Error &err)
 Construct a failed result from a const Error reference.
 
 expected (Error &&err)
 Construct a failed result by moving an Error.
 
 expected (ErrorCode code, std::string msg)
 Convenience constructor: build an Error in-place from a code and message.
 
bool has_value () const
 Return true if the result represents success (no error).
 
 operator bool () const
 Return true if the result represents success.
 
const Errorerror () const
 Access the error payload (valid for both success and failure; check ok() on the returned Error).
 

Detailed Description

Specialization of expected for void — used for operations that return success or error only.

Side-effect-only operations (e.g. write_column(), close(), flush_row_group()) return expected<void>. There is no success payload; callers simply check has_value() or operator bool() and, on failure, inspect error().

auto result = writer.close();
if (!result) {
log("close failed: " + result.error().message);
}
See also
expected<T> for the general (non-void) template.

Definition at line 239 of file error.hpp.

Constructor & Destructor Documentation

◆ expected() [1/4]

signet::forge::expected< void >::expected ( )
inline

Construct a successful (OK) result with no payload.

Definition at line 242 of file error.hpp.

◆ expected() [2/4]

signet::forge::expected< void >::expected ( const Error err)
inline

Construct a failed result from a const Error reference.

Parameters
errThe error to store.

Definition at line 245 of file error.hpp.

◆ expected() [3/4]

signet::forge::expected< void >::expected ( Error &&  err)
inline

Construct a failed result by moving an Error.

Parameters
errThe error to move-store.

Definition at line 248 of file error.hpp.

◆ expected() [4/4]

signet::forge::expected< void >::expected ( ErrorCode  code,
std::string  msg 
)
inline

Convenience constructor: build an Error in-place from a code and message.

Parameters
codeThe ErrorCode category.
msgA human-readable error description.

Definition at line 252 of file error.hpp.

Member Function Documentation

◆ error()

const Error & signet::forge::expected< void >::error ( ) const
inline

Access the error payload (valid for both success and failure; check ok() on the returned Error).

Returns
Const reference to the stored Error.

Definition at line 261 of file error.hpp.

◆ has_value()

bool signet::forge::expected< void >::has_value ( ) const
inline

Return true if the result represents success (no error).

Definition at line 255 of file error.hpp.

◆ operator bool()

signet::forge::expected< void >::operator bool ( ) const
inlineexplicit

Return true if the result represents success.

Note
Explicit to prevent accidental implicit conversions.

Definition at line 258 of file error.hpp.


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