From ecaf9c97d03843982286e383b5d5b410e724e459 Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Thu, 19 Oct 2023 19:58:42 +0200 Subject: [PATCH] Add Serialization section to kv::Value docs --- src/kv/value.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/kv/value.rs b/src/kv/value.rs index 312232003..4cc5729c4 100644 --- a/src/kv/value.rs +++ b/src/kv/value.rs @@ -132,6 +132,18 @@ macro_rules! as_sval { /// /// assert_eq!(Some(42), value.to_i64()); /// ``` +/// +/// # Serialization +/// +/// `Value` provides a number of ways to be serialized. +/// +/// For basic types the [`Value::visit`] method can be used to extract the +/// underlying typed value. However this is limited in the amount of types +/// supported (see the [`Visit`] trait methods). +/// +/// For more complex types one of the following traits can be used: +/// * [`sval::Value`], requires the `kv_unstable_sval` feature. +/// * [`serde::Serialize`], requires the `kv_unstable_serde` feature. pub struct Value<'v> { inner: ValueBag<'v>, } @@ -620,6 +632,10 @@ mod std_support { } /// A visitor for a `Value`. +/// +/// Also see [`Value`'s documentation on seralization]. +/// +/// [`Value`'s documentation on seralization]: Value#serialization pub trait Visit<'v> { /// Visit a `Value`. ///