Wasmtime
wasmtime::component::Variant Class Reference

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

#include <val.hh>

Public Member Functions

 Variant (Raw &&capi)
 
 Variant (const Variant &other)
 Copy constructor to clone other.
More...
 
Variant & operator= (const Variant &other)
 Copy assignment to clone from other.
More...
 
 Variant (Variant &&other)
 Move constructor to move the contents of other.
More...
 
Variant & operator= (Variant &&other)
 Move assignment to move the contents of other.
More...
 
const Raw * capi () const
 Returns a pointer to the underlying C API representation.
More...
 
 Variant (std::string_view discriminant, std::optional< Val > x)
 Constructs a new variant value with the provided discriminant and payload.
 
std::string_view discriminant () const
 Returns the name of the discriminant of this value.
 
const Val * value () const
 Returns the optional payload value associated with this variant value.
 

Static Public Member Functions

static const Variant * from_capi (const Raw *capi)
 
static Variant * from_capi (Raw *capi)
 
static const Raw * to_capi (const Variant *capi)
 
static Raw * to_capi (Variant *capi)
 

Friends

class Val
 

Detailed Description

Class representing a component model variant value.

Constructor & Destructor Documentation

◆ Variant() [1/3]

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

◆ Variant() [2/3]

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

Copy constructor to clone other.

◆ Variant() [3/3]

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

Move constructor to move the contents of other.

Member Function Documentation

◆ capi()

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

Returns a pointer to the underlying C API representation.

◆ from_capi() [1/2]

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

◆ from_capi() [2/2]

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

◆ operator=() [1/2]

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

Copy assignment to clone from other.

◆ operator=() [2/2]

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

Move assignment to move the contents of other.

◆ to_capi() [1/2]

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

◆ to_capi() [2/2]

static Raw * wasmtime::component::Variant::to_capi ( Variant *  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: