runtime 1.1.4
Checked CEL programs, owned values, and reusable execution stacks
Loading...
Searching...
No Matches
cel::record_adapter< T > Struct Template Reference

Adapts one client nominal record type to and from canonical CEL record values. More...

#include <cel/runtime/record_adapter.hpp>

Detailed Description

template<class T>
struct cel::record_adapter< T >

Adapts one client nominal record type to and from canonical CEL record values.

Specialize this template for one client type T to expose it as a nominal record. type() must return a nominal record descriptor. to_value() must return a value with exactly that descriptor. from_value() should validate complete descriptor identity before decoding and throw std::invalid_argument when mismatched.

Example:

struct point {
double x;
double y;
};
template <>
struct cel::record_adapter<point> {
static cel::value_type type() {
static const auto descriptor = cel::value_type::record(
"sample.point",
return descriptor;
}
static cel::value to_value(const point& source);
static point from_value(const cel::value& source);
};
An immutable, shared semantic type with a canonical byte layout.
Definition value_type.hpp:65
static value_type leaf()
Returns T's descriptor as an opaque, trivially copyable leaf.
Definition value_type.hpp:122
static value_type record(std::string_view identity, std::span< const record_field > fields)
Creates named fields with a nonempty nominal identity.
Adapts one client nominal record type to and from canonical CEL record values.
Definition record_adapter.hpp:38
A source-order name/type pair validated by value_type::record.
Definition value_type.hpp:272

The documentation for this struct was generated from the following file: