simdjson 4.2.2
Ridiculously Fast JSON
Loading...
Searching...
No Matches
simdjson::simdjson_result< T > Struct Template Reference

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

#include <error.h>

Inherits simdjson::internal::simdjson_result_base< T >.

Public Types

using value_type = T
 
using error_type = error_code
 

Public Member Functions

simdjson_inline void tie (T &value, error_code &error) &&noexcept
 Move the value and the error to the provided variables.
 
simdjson_warn_unused simdjson_inline error_code get (T &value) &&noexcept
 Move the value to the provided variable.
 
template<typename U = T>
simdjson_warn_unused simdjson_inline error_code get (std::string &value) &&noexcept
 Copy the value to a provided std::string, only enabled for std::string_view.
 
simdjson_inline error_code error () const noexcept
 The error.
 
simdjson_inline T & value () &noexcept(false)
 Get the result value.
 
simdjson_inline T && value () &&noexcept(false)
 Take the result value (move it).
 
simdjson_inline T && take_value () &&noexcept(false)
 Take the result value (move it).
 
simdjson_inline operator T&& () &&noexcept(false)
 Cast to the value (will throw on error).
 
simdjson_inline const T & value_unsafe () const &noexcept
 Get the result value.
 
simdjson_inline T && value_unsafe () &&noexcept
 Take the result value (move it).
 

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 280 of file error.h.

Member Typedef Documentation

◆ error_type

template<typename T >
using simdjson::simdjson_result< T >::error_type = error_code

Definition at line 382 of file error.h.

◆ value_type

template<typename T >
using simdjson::simdjson_result< T >::value_type = T

Definition at line 381 of file error.h.

Member Function Documentation

◆ error()

template<typename T >
simdjson_inline error_code simdjson::simdjson_result< T >::error ( ) const
noexcept

The error.

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

◆ get() [1/2]

template<typename T >
template<typename U = T>
simdjson_warn_unused simdjson_inline error_code simdjson::simdjson_result< T >::get ( std::string &  value) &&
inlinenoexcept

Copy the value to a provided std::string, only enabled for std::string_view.

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

Definition at line 320 of file error.h.

◆ get() [2/2]

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 163 of file error-inl.h.

◆ operator T&&()

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

Cast to the value (will throw on error).

Exceptions
simdjson_errorif there was an error.

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

◆ take_value()

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

Take the result value (move it).

Exceptions
simdjson_errorif there was an error.

Definition at line 185 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 157 of file error-inl.h.

◆ value() [1/2]

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

Take the result value (move it).

Exceptions
simdjson_errorif there was an error.

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

◆ value() [2/2]

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

Get the result value.

Exceptions
simdjson_errorif there was an error.

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

◆ 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.

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

◆ 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.

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


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