Appends deterministic, byte-aligned fields to an owned buffer.
More...
|
| template<std::unsigned_integral T> |
| void | field (T value) |
| | Writes an unsigned integer in little-endian order.
|
| template<class T, std::size_t N> |
| void | field (const std::array< T, N > &value) |
| | Writes each array element in order, without a length prefix.
|
| template<class... Ts> |
| void | field (const std::variant< Ts... > &value) |
| | Writes a variant's alternative index and active value.
|
| template<class T> |
| void | field (const std::unique_ptr< T > &value) |
| | Writes a boxed value without pointer or presence bytes.
|
template<class T>
requires requires(const T& v, writer& s) { v.serialize(s); } |
| void | field (const T &value) |
| | Invokes a custom type's serialize method through a const reference.
|
| template<class... Ts> |
| void | operator() (const Ts &... values) |
| | Writes fields from left to right using the matching field overloads.
|
|
|
bytes | data |
| | Serialized output in field order.
|
|
|
static constexpr bool | reading = false |
| | Selects the writing path in serializers.
|
Appends deterministic, byte-aligned fields to an owned buffer.
- Note
- Custom serializers must preserve their input values when writing.
Definition at line 39 of file serialization.ccm.
◆ field() [1/5]
template<class T, std::size_t N>
| void auth::writer::field |
( |
const std::array< T, N > & | value | ) |
|
|
inline |
Writes each array element in order, without a length prefix.
- Parameters
-
| value | Fixed-size array to encode. |
Definition at line 60 of file serialization.ccm.
◆ field() [2/5]
template<class T>
| void auth::writer::field |
( |
const std::unique_ptr< T > & | value | ) |
|
|
inline |
Writes a boxed value without pointer or presence bytes.
- Parameters
-
| value | Non-null owning pointer used for recursive structure. |
- Exceptions
-
| auth_error | If the pointer is null. Use a variant for an empty alternative. |
Definition at line 81 of file serialization.ccm.
◆ field() [3/5]
template<class... Ts>
| void auth::writer::field |
( |
const std::variant< Ts... > & | value | ) |
|
|
inline |
Writes a variant's alternative index and active value.
- Parameters
-
| value | Variant to encode; indices use one byte for up to 256 alternatives, otherwise four little-endian bytes. |
- Exceptions
-
Definition at line 70 of file serialization.ccm.
◆ field() [4/5]
template<class T>
requires requires(const T& v,
writer& s) { v.serialize(s); }
| void auth::writer::field |
( |
const T & | value | ) |
|
|
inline |
Invokes a custom type's serialize method through a const reference.
- Parameters
-
| value | Value whose serializer writes its fields to this stream. |
- Note
- A private serializer may grant friendship to writer.
Definition at line 91 of file serialization.ccm.
◆ field() [5/5]
template<std::unsigned_integral T>
| void auth::writer::field |
( |
T | value | ) |
|
|
inline |
Writes an unsigned integer in little-endian order.
- Parameters
-
| value | Integer encoded in sizeof(T) bytes, or a bool encoded as one byte, 0 or 1. |
Definition at line 47 of file serialization.ccm.
◆ operator()()
template<class... Ts>
| void auth::writer::operator() |
( |
const Ts &... | values | ) |
|
|
inline |
Writes fields from left to right using the matching field overloads.
- Parameters
-
Definition at line 97 of file serialization.ccm.
The documentation for this struct was generated from the following file: