Skip to content

Value::from_serde ? #819

Open
Open
@anp

Description

@anp

Feature Request

Motivation

I'd like to allow my subscriber to record arbitrarily nested objects from users' macros.

Proposal

I'd like some way to create a Value from the erased-serde traits (erased to reduce binary bloat). The basic sketch proposed by @KodrAus in rust-lang/log#328 (comment) for the log crate seems compelling to me but I haven't worked through all of the implications for tracing.

Alternatives

The most significant assumption of this request is that serde-based traits should be the public API. It's possible that we would be better off extending Value to support nesting in a different way (and offering a polyfill for serde implementors?).

It's also possible that Value is not the right place to include this compatibility but my naive impression is that it's probably the right call.

Another potential alternative would be to reuse the Value type from the log crate's kv support or to work with them to extract that type into a lower-level shared crate. This seems like a great target to drive towards but I suspect both projects will be better served by converging on a shared type once they both have their respective use cases understood and addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/coreRelated to the `tracing-core` cratekind/featureNew feature or requestkind/rfcA request for comments to discuss future changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions