From 7b73fa68155fb997b7a7dbad9f1a0e4441ccec50 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Wed, 26 Mar 2025 00:15:07 +0000 Subject: README: briefly document the serialization interface --- README | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'README') diff --git a/README b/README index 953feee..4739e62 100644 --- a/README +++ b/README @@ -34,6 +34,28 @@ iterator interface: // do something with value... } +serialization interface: + + struct object { + std::uint64_t int_value{}; + std::string string_value{}; + std::vector array_value; + }; + + template<> struct bsd::nv_schema { + auto get() { + return bsd::nv_field("int value", &object::int_value) + >> bsd::nv_field("string value", &object::string_value) + >> bsd::nv_field("array value", &object::array_value); + } + }; + + // ... + + object obj{}; + nv_list nvl = bsd::nv_serialize(obj); + object obj2 = bsd::nv_deserialize(nvl); + infrequently asked questions: Q: what version of FreeBSD does libnvxx require? -- cgit v1.2.3