Skip to main content

Crate sval_ref

Crate sval_ref 

Source
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::Value into a ValueRef.

Traits§

ValueRef
A producer of structured data that stores a reference internally.

Functions§

stream_ref
Stream a value through a stream.
to_ref
Wrap an sval::Value in a ValueRef