Barretenberg
The ZK-SNARK library at the core of Aztec
|
A wrapper around std::variant that provides msgpack serialization based on type names. More...
#include <named_union.hpp>
Public Types | |
using | VariantType = std::variant< Types... > |
Public Member Functions | |
NamedUnion ()=default | |
template<typename T > requires (std::is_constructible_v<VariantType, T>) | |
NamedUnion (T &&t) | |
operator VariantType & () | |
operator const VariantType & () const | |
VariantType & | get () |
const VariantType & | get () const |
template<typename Visitor > | |
decltype(auto) | visit (Visitor &&vis) && |
template<typename Visitor > | |
decltype(auto) | visit (Visitor &&vis) const & |
std::string_view | get_type_name () const |
void | msgpack_pack (auto &packer) const |
void | msgpack_unpack (msgpack::object const &o) |
void | msgpack_schema (auto &packer) const |
Static Private Member Functions | |
template<size_t I = 0> | |
static std::optional< size_t > | get_index_from_name (std::string_view name) |
template<size_t I = 0> | |
static VariantType | construct_by_index (size_t index, auto &o) |
Private Attributes | |
VariantType | value_ |
A wrapper around std::variant that provides msgpack serialization based on type names.
Each type in the variant must have a static constexpr NAME member that identifies it. During serialization, the NAME is written first, then the object. During deserialization, the NAME is read first to determine which type to construct.
Definition at line 33 of file named_union.hpp.
using bb::NamedUnion< Types >::VariantType = std::variant<Types...> |
Definition at line 35 of file named_union.hpp.
|
default |
|
inline |
Definition at line 74 of file named_union.hpp.
|
inlinestaticprivate |
Definition at line 54 of file named_union.hpp.
|
inline |
Definition at line 83 of file named_union.hpp.
|
inline |
Definition at line 84 of file named_union.hpp.
|
inlinestaticprivate |
Definition at line 41 of file named_union.hpp.
|
inline |
Definition at line 98 of file named_union.hpp.
|
inline |
Definition at line 106 of file named_union.hpp.
|
inline |
Definition at line 141 of file named_union.hpp.
|
inline |
Definition at line 118 of file named_union.hpp.
|
inline |
Definition at line 80 of file named_union.hpp.
|
inline |
Definition at line 79 of file named_union.hpp.
|
inline |
Definition at line 87 of file named_union.hpp.
|
inline |
Definition at line 92 of file named_union.hpp.
|
private |
Definition at line 38 of file named_union.hpp.