![]() |
Pixie
|
CRTP facade for optional binary serialization and deserialization. More...
#include <serialization.h>
Public Member Functions | |
| void | serialize (BinaryWriter &writer) const |
| Serialize this value through its concrete implementation. | |
Static Public Member Functions | |
| template<class... Context> requires requires(BinaryReader& input, Context&&... arguments) { { Derived::deserialize_impl(input, std::forward<Context>(arguments)...) } -> std::same_as<Derived>; } | |
| static Derived | deserialize (BinaryReader &reader, Context &&... context) |
Restore exactly Derived and advance reader on success. | |
| template<class... Context> requires requires(BinaryReader& input, Context&&... arguments) { { Derived::deserialize_impl(input, std::forward<Context>(arguments)...) } -> std::same_as<Derived>; } | |
| static Derived | deserialize (std::span< const std::byte > &data, Context &&... context) |
Restore exactly Derived and advance a mutable byte span. | |
CRTP facade for optional binary serialization and deserialization.
A derived type opts into serialization by providing serialize_impl(BinaryWriter&) const, and opts into restoration for a context by providing a static deserialize_impl(BinaryReader&, context...) returning exactly the derived type. Deserialization is transactional: the caller's cursor (or mutable input span) advances only after the complete implementation succeeds.
| Derived | Concrete serializable type. |
|
inlinestatic |
Restore exactly Derived and advance reader on success.
Any contextual arguments follow the reader. The reader is unchanged if parsing, allocation, or validation throws.
|
inlinestatic |
Restore exactly Derived and advance a mutable byte span.
This shared convenience overload has the same transactional behavior as the BinaryReader overload.