Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serialization section to kv::Value docs #593

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/kv/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}
Expand Down Expand Up @@ -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`.
///
Expand Down