MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / Tuple

Class Tuple

crates/c-api/include/wasmtime/component/val.hh:209–240  ·  view source on GitHub ↗

\brief Class representing a component model tuple.

Source from the content-addressed store, hash-verified

207
208/// \brief Class representing a component model tuple.
209class Tuple {
210 friend class Val;
211
212 VAL_REPR(Tuple, wasmtime_component_valtuple_t);
213
214 static void transfer(Raw &&from, Raw &to) {
215 to = from;
216 from.size = 0;
217 from.data = nullptr;
218 }
219
220 void copy(const Raw &other) {
221 wasmtime_component_valtuple_copy(&raw, &other);
222 }
223
224 void destroy() { wasmtime_component_valtuple_delete(&raw); }
225
226public:
227 /// Creates a new tuple from the named field pairs provided.
228 Tuple(std::vector<Val> entries);
229
230 /// \brief Returns the number of entries in the tuple.
231 size_t size() const { return raw.size; }
232
233 /// \brief Returns an iterator to the beginning of the tuple.
234 const Val *begin() const { return reinterpret_cast<const Val *>(raw.data); }
235
236 /// \brief Returns an iterator to the end of the tuple.
237 const Val *end() const {
238 return reinterpret_cast<const Val *>(raw.data + raw.size);
239 }
240};
241
242/// Class representing a component model `variant` value.
243class Variant {

Callers 3

fromMethod · 0.50
fromMethod · 0.50
TESTFunction · 0.50

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.40