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
1,300,796 downloads per month
Used in 26 crates
(8 directly)
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
A variant of sval::Value for types with internal references.