Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::gpu::Result< T > Class Template Reference

Result of a fallible GPU operation: exactly one of a value of type T or a GpuError. More...

#include "donner/gpu/GpuResult.h"

Public Member Functions

 Result (T &&result)
 Construct from a successful result.
 Result (const T &result)
 Construct from a successful result by copy.
 Result (GpuError &&error)
 Construct from an error.
 Result (const GpuError &error)
 Construct from an error by copy.
T & result () &
 Returns the contained result.
T && result () &&
 Returns the contained result (move).
const T & result () const &
 Returns the contained result.
GpuErrorerror () &
 Returns the contained error.
GpuError && error () &&
 Returns the contained error (move).
const GpuErrorerror () const &
 Returns the contained error.
bool hasResult () const noexcept
 Returns true if this Result contains a value.
bool hasError () const noexcept
 Returns true if this Result contains an error.

Detailed Description

template<typename T>
class donner::gpu::Result< T >

Result of a fallible GPU operation: exactly one of a value of type T or a GpuError.

The GPU runtime uses no exceptions; this is the only failure channel. The accessor shape (hasResult / result / error) mirrors donner::ParseResult so call sites read the same across the codebase, but unlike ParseResult a GPU operation never returns a partial result together with an error.

Template Parameters
TResult type.

Constructor & Destructor Documentation

◆ Result() [1/4]

template<typename T>
donner::gpu::Result< T >::Result ( T && result)
inline

Construct from a successful result.

Parameters
resultResult value.

◆ Result() [2/4]

template<typename T>
donner::gpu::Result< T >::Result ( const T & result)
inline

Construct from a successful result by copy.

Parameters
resultResult value.

◆ Result() [3/4]

template<typename T>
donner::gpu::Result< T >::Result ( GpuError && error)
inline

Construct from an error.

Parameters
errorError value.

◆ Result() [4/4]

template<typename T>
donner::gpu::Result< T >::Result ( const GpuError & error)
inline

Construct from an error by copy.

Parameters
errorError value.

Member Function Documentation

◆ error() [1/3]

template<typename T>
GpuError & donner::gpu::Result< T >::error ( ) &
inline

Returns the contained error.

Precondition
There is a valid error, i.e. hasError() returns true.

◆ error() [2/3]

template<typename T>
GpuError && donner::gpu::Result< T >::error ( ) &&
inline

Returns the contained error (move).

Precondition
There is a valid error, i.e. hasError() returns true.

◆ error() [3/3]

template<typename T>
const GpuError & donner::gpu::Result< T >::error ( ) const &
inline

Returns the contained error.

Precondition
There is a valid error, i.e. hasError() returns true.

◆ result() [1/3]

template<typename T>
T & donner::gpu::Result< T >::result ( ) &
inline

Returns the contained result.

Precondition
There is a valid result, i.e. hasResult() returns true.

◆ result() [2/3]

template<typename T>
T && donner::gpu::Result< T >::result ( ) &&
inline

Returns the contained result (move).

Precondition
There is a valid result, i.e. hasResult() returns true.

◆ result() [3/3]

template<typename T>
const T & donner::gpu::Result< T >::result ( ) const &
inline

Returns the contained result.

Precondition
There is a valid result, i.e. hasResult() returns true.

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