sval-rs / value-bag

Dynamic structured values for Rust
Apache License 2.0
27 stars 3 forks source link

Support capturing owned values in ValueBag<'v> itself #84

Closed KodrAus closed 7 months ago

KodrAus commented 7 months ago

Closes #69

This PR makes it possible to stash an owned value in a ValueBag<'v> itself without first needing to buffer it. The main motivation for this is to support short-term buffering in log's key-value API, where users who want to build a log::kv::Source need to fully buffer all key-value pairs first due to lifetime constraints. This new functionality could be used to only require buffering a single key-value pair at a time by making it easy to produce a ValueBag<'static>.