aboutsummaryrefslogtreecommitdiffstats
path: root/README
diff options
context:
space:
mode:
authorLexi Winter <lexi@hemlock.eden.le-fay.org>2025-03-26 00:15:07 +0000
committerLexi Winter <lexi@hemlock.eden.le-fay.org>2025-03-26 00:15:07 +0000
commit7b73fa68155fb997b7a7dbad9f1a0e4441ccec50 (patch)
tree9649a852febd087d5eed9bfa0074c607eb7b1a9c /README
parente1009551ac01e0ab6768855cc45cd18de98ca802 (diff)
downloadlibnvxx-7b73fa68155fb997b7a7dbad9f1a0e4441ccec50.tar.gz
libnvxx-7b73fa68155fb997b7a7dbad9f1a0e4441ccec50.tar.bz2
README: briefly document the serialization interface
Diffstat (limited to 'README')
-rw-r--r--README22
1 files changed, 22 insertions, 0 deletions
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<std::uint64_t> array_value;
+ };
+
+ template<> struct bsd::nv_schema<object> {
+ 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<object>(nvl);
+
infrequently asked questions:
Q: what version of FreeBSD does libnvxx require?