Expand description
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>.
Structs§
- Ref
- Adapt an
sval::Valueinto aValueRef.
Traits§
- Value
Ref - A producer of structured data that stores a reference internally.
Functions§
- stream_
ref - Stream a value through a stream.
- to_ref
- Wrap an
sval::Valuein aValueRef