\brief Class representing a component model tuple.
| 207 | |
| 208 | /// \brief Class representing a component model tuple. |
| 209 | class 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 | |
| 226 | public: |
| 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. |
| 243 | class Variant { |