Wasmtime
wasmtime::component::WitResult Class Reference

Class representing a component model result value. More...

#include <val.hh>

Public Member Functions

 WitResult (Raw &&capi)
 
 WitResult (const WitResult &other)
 Copy constructor to clone other.
More...
 
WitResult & operator= (const WitResult &other)
 Copy assignment to clone from other.
More...
 
 WitResult (WitResult &&other)
 Move constructor to move the contents of other.
More...
 
WitResult & operator= (WitResult &&other)
 Move assignment to move the contents of other.
More...
 
const Raw * capi () const
 Returns a pointer to the underlying C API representation.
More...
 
bool is_ok () const
 Returns whether this result is the ok variant.
 
const Val * payload () const
 Returns the optional payload value associated with this result.
 

Static Public Member Functions

static const WitResult * from_capi (const Raw *capi)
 
static WitResult * from_capi (Raw *capi)
 
static const Raw * to_capi (const WitResult *capi)
 
static Raw * to_capi (WitResult *capi)
 
static WitResult ok (std::optional< Val > val)
 Constructs a new result value with the ok variant.
 
static WitResult err (std::optional< Val > val)
 Constructs a new result value with the err variant.
 

Friends

class Val
 

Detailed Description

Class representing a component model result value.

Constructor & Destructor Documentation

◆ WitResult() [1/3]

wasmtime::component::WitResult::WitResult ( Raw &&  capi)
inlineexplicit
  • Create a variant that takes ownership of the underlying C API variant.

◆ WitResult() [2/3]

wasmtime::component::WitResult::WitResult ( const WitResult &  other)
inline

Copy constructor to clone other.

◆ WitResult() [3/3]

wasmtime::component::WitResult::WitResult ( WitResult &&  other)
inline

Move constructor to move the contents of other.

Member Function Documentation

◆ capi()

const Raw * wasmtime::component::WitResult::capi ( ) const
inline

Returns a pointer to the underlying C API representation.

◆ from_capi() [1/2]

static const WitResult * wasmtime::component::WitResult::from_capi ( const Raw *  capi)
inlinestatic
  • Converts the raw C API representation to this class without taking * ownership.

◆ from_capi() [2/2]

static WitResult * wasmtime::component::WitResult::from_capi ( Raw *  capi)
inlinestatic
  • Converts the raw C API representation to this class without taking * ownership.

◆ operator=() [1/2]

WitResult & wasmtime::component::WitResult::operator= ( const WitResult &  other)
inline

Copy assignment to clone from other.

◆ operator=() [2/2]

WitResult & wasmtime::component::WitResult::operator= ( WitResult &&  other)
inline

Move assignment to move the contents of other.

◆ to_capi() [1/2]

static const Raw * wasmtime::component::WitResult::to_capi ( const WitResult *  capi)
inlinestatic
  • Converts to the raw C API representation to this class without taking * ownership.

◆ to_capi() [2/2]

static Raw * wasmtime::component::WitResult::to_capi ( WitResult *  capi)
inlinestatic
  • Converts to the raw C API representation to this class without taking * ownership.

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