Reads checked fields from borrowed bytes, advancing a byte offset.
More...
|
| template<std::unsigned_integral T> |
| void | field (T &value) |
| | Reads a little-endian unsigned integer, or a one-byte boolean.
|
| template<class T, std::size_t N> |
| void | field (std::array< T, N > &value) |
| | Reads each array element in order; no length prefix is consumed.
|
| template<class... Ts> |
| void | field (std::variant< Ts... > &value) |
| | Reads a variant's index and constructs and fills its selected alternative.
|
| template<class T> |
| void | field (std::unique_ptr< T > &value) |
| | Allocates and reads a boxed value, replacing the pointer on success.
|
template<class T>
requires requires(T& v, reader& s) { v.serialize(s); } |
| void | field (T &value) |
| | Invokes a custom type's serialize method through a mutable reference.
|
| template<class... Ts> |
| void | operator() (Ts &... values) |
| | Reads fields from left to right using the matching field overloads.
|
|
|
std::span< const std::uint8_t > | data |
| | Borrowed input bytes.
|
|
std::size_t | position = 0 |
| | Offset of the next unread byte.
|
|
|
static constexpr bool | reading = true |
| | Selects the reading path in serializers.
|
Reads checked fields from borrowed bytes, advancing a byte offset.
- Precondition
- position is at most data.size().
- Note
- Input storage must remain valid and unchanged during reading. A failed read may modify the cursor and destination; decode uses a local reader.
Definition at line 105 of file serialization.ccm.
◆ field() [1/5]
template<class T, std::size_t N>
| void auth::reader::field |
( |
std::array< T, N > & | value | ) |
|
|
inline |
Reads each array element in order; no length prefix is consumed.
- Parameters
-
| [out] | value | Fixed-size array to fill. |
Definition at line 133 of file serialization.ccm.
◆ field() [2/5]
template<class T>
| void auth::reader::field |
( |
std::unique_ptr< T > & | value | ) |
|
|
inline |
Allocates and reads a boxed value, replacing the pointer on success.
- Parameters
-
| [out] | value | Owning pointer to a default-constructible payload. |
Definition at line 153 of file serialization.ccm.
◆ field() [3/5]
template<class... Ts>
| void auth::reader::field |
( |
std::variant< Ts... > & | value | ) |
|
|
inline |
Reads a variant's index and constructs and fills its selected alternative.
- Parameters
-
| [out] | value | Variant whose alternatives must be default-constructible. |
- Exceptions
-
| auth_error | If the index is invalid or the encoding is malformed. |
Definition at line 142 of file serialization.ccm.
◆ field() [4/5]
template<class T>
requires requires(T& v,
reader& s) { v.serialize(s); }
| void auth::reader::field |
( |
T & | value | ) |
|
|
inline |
Invokes a custom type's serialize method through a mutable reference.
- Parameters
-
| [in,out] | value | Value whose serializer reads its fields from this stream. |
- Note
- A private serializer may grant friendship to reader.
Definition at line 164 of file serialization.ccm.
◆ field() [5/5]
template<std::unsigned_integral T>
| void auth::reader::field |
( |
T & | value | ) |
|
|
inline |
Reads a little-endian unsigned integer, or a one-byte boolean.
- Parameters
-
- Exceptions
-
| auth_error | If the input is truncated or a boolean is not 0 or 1. |
Definition at line 115 of file serialization.ccm.
◆ operator()()
template<class... Ts>
| void auth::reader::operator() |
( |
Ts &... | values | ) |
|
|
inline |
Reads fields from left to right using the matching field overloads.
- Parameters
-
| [out] | values | Fields to decode. |
Definition at line 170 of file serialization.ccm.
The documentation for this struct was generated from the following file: