#serialization #no-std

no-std sval_ref

A variant of sval::Value for types with internal references

31 stable releases

new 2.19.0 May 8, 2026
2.18.0 Mar 27, 2026
2.17.0 Feb 7, 2026
2.16.0 Oct 19, 2025
2.6.1 Jun 27, 2023

#2984 in Encoding

Download history 595546/week @ 2026-01-18 523190/week @ 2026-01-25 476273/week @ 2026-02-01 457408/week @ 2026-02-08 437958/week @ 2026-02-15 457817/week @ 2026-02-22 571063/week @ 2026-03-01 513363/week @ 2026-03-08 443901/week @ 2026-03-15 374596/week @ 2026-03-22 359818/week @ 2026-03-29 362313/week @ 2026-04-05 346660/week @ 2026-04-12 333943/week @ 2026-04-19 302939/week @ 2026-04-26 300515/week @ 2026-05-03

1,300,796 downloads per month
Used in 26 crates (8 directly)

Apache-2.0 OR MIT

175KB
3.5K SLoC

A variant of sval::Value for types that store references internally.

Deriving ValueRef

Add the ref feature to sval_derive:

[dependencies.sval_derive]
version = "2.19.0"
features = ["ref"]

and include the #[sval(ref)] attribute when deriving Value:

#[derive(Value)]
#[sval(ref)]
pub struct MyData<'a> {
#[sval(outer_ref)]
data: &'a str,
}

Fields are streamed as computed by default. Use the #[sval(outer_ref)] attribute for fields with external references like &'a str, and the #[sval(inner_ref)] attribute for fields with internal references like Data<'a>.


sval_ref

Rust Latest version Documentation Latest

A variant of sval::Value for types with internal references.

Dependencies