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

Class Flags

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

Class representing a component model `flags` value.

Source from the content-addressed store, hash-verified

380
381/// Class representing a component model `flags` value.
382class Flags {
383 friend class Val;
384
385 VAL_REPR(Flags, wasmtime_component_valflags_t);
386
387 static void transfer(Raw &&from, Raw &to) {
388 to = from;
389 from.size = 0;
390 from.data = nullptr;
391 }
392
393 void copy(const Raw &other) {
394 wasmtime_component_valflags_copy(&raw, &other);
395 }
396
397 void destroy() { wasmtime_component_valflags_delete(&raw); }
398
399public:
400 /// Creates a new flags value from the provided flags.
401 Flags(std::vector<Flag> flags) {
402 wasmtime_component_valflags_new_uninit(&raw, flags.size());
403 auto dst = raw.data;
404 for (auto &&val : flags)
405 Flag::transfer(std::move(val.raw), *dst++);
406 }
407
408 /// \brief Returns the number of flags.
409 size_t size() const { return raw.size; }
410
411 /// \brief Returns an iterator to the beginning of the flags.
412 const Flag *begin() const { return reinterpret_cast<const Flag *>(raw.data); }
413
414 /// \brief Returns an iterator to the end of the flags.
415 const Flag *end() const {
416 return reinterpret_cast<const Flag *>(raw.data + raw.size);
417 }
418};
419
420/// \brief Class representing an entry in a map value.
421class MapEntry {

Callers 3

fromMethod · 0.50
fromMethod · 0.50
TESTFunction · 0.50

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.40