simdjson  3.11.0
Ridiculously Fast JSON
simdjson::simdjson_result< T > Struct Template Reference

The result of a simdjson operation that could fail. More...

Inheritance diagram for simdjson::simdjson_result< T >:

Public Member Functions

simdjson_inline void tie (T &value, error_code &error) &&noexcept
 Move the value and the error to the provided variables. More...
 
simdjson_warn_unused simdjson_inline error_code get (T &value) &&noexcept
 Move the value to the provided variable. More...
 
simdjson_inline error_code error () const noexcept
 The error.
 
simdjson_inline T & value () &noexcept(false)
 Get the result value. More...
 
simdjson_inline T && value () &&noexcept(false)
 Take the result value (move it). More...
 
simdjson_inline T && take_value () &&noexcept(false)
 Take the result value (move it). More...
 
simdjson_inline operator T&& () &&noexcept(false)
 Cast to the value (will throw on error). More...
 
simdjson_inline const T & value_unsafe () const &noexcept
 Get the result value. More...
 
simdjson_inline T && value_unsafe () &&noexcept
 Take the result value (move it). More...
 

Detailed Description

template<typename T>
struct simdjson::simdjson_result< T >

The result of a simdjson operation that could fail.

Gives the option of reading error codes, or throwing an exception by casting to the desired result.

Definition at line 215 of file error.h.

Member Function Documentation

◆ get()

template<typename T >
simdjson_warn_unused simdjson_inline error_code simdjson::simdjson_result< T >::get ( T &  value) &&
noexcept

Move the value to the provided variable.

Parameters
valueThe variable to assign the value to. May not be set if there is an error.

Definition at line 126 of file error-inl.h.

◆ operator T&&()

template<typename T >
simdjson_inline simdjson::simdjson_result< T >::operator T&& ( ) &&
noexcept

Cast to the value (will throw on error).

Exceptions
simdjson_errorif there was an error.

Definition at line 153 of file error-inl.h.

◆ take_value()

template<typename T >
simdjson_inline T && simdjson::simdjson_result< T >::take_value ( ) &&
noexcept

Take the result value (move it).

Exceptions
simdjson_errorif there was an error.

Definition at line 148 of file error-inl.h.

◆ tie()

template<typename T >
simdjson_inline void simdjson::simdjson_result< T >::tie ( T &  value,
error_code error 
) &&
noexcept

Move the value and the error to the provided variables.

simdjson_result<T> inline implementation

Parameters
valueThe variable to assign the value to. May not be set if there is an error.
errorThe variable to assign the error to. Set to SUCCESS if there is no error.

Definition at line 121 of file error-inl.h.

◆ value() [1/2]

template<typename T >
simdjson_inline T&& simdjson::simdjson_result< T >::value ( ) &&
noexcept

Take the result value (move it).

Exceptions
simdjson_errorif there was an error.

◆ value() [2/2]

template<typename T >
simdjson_inline T& simdjson::simdjson_result< T >::value ( ) &
noexcept

Get the result value.

Exceptions
simdjson_errorif there was an error.

◆ value_unsafe() [1/2]

template<typename T >
simdjson_inline T&& simdjson::simdjson_result< T >::value_unsafe ( ) &&
noexcept

Take the result value (move it).

This function is safe if and only the error() method returns a value that evaluates to false.

◆ value_unsafe() [2/2]

template<typename T >
simdjson_inline const T& simdjson::simdjson_result< T >::value_unsafe ( ) const &
noexcept

Get the result value.

This function is safe if and only the error() method returns a value that evaluates to false.


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