tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.44k stars 717 forks source link

core: Rework ValueSets to support indexing in addition to visiting #926

Open davidbarsky opened 4 years ago

davidbarsky commented 4 years ago

Feature Request

Crates

Motivation

The current tracing_core::field::ValueSet requires users to implement a visitor to process and record Values. While this is performant, users have expressed confusion and occasional frustration with this requirement.

Proposal

We should consider dispatching Value primitive values using an enum rather than a trait object in order to... (I'm not sure, @hawkw, can you add additional details?)

hawkw commented 4 years ago

@hawkw shared a sketch of a possible approach.

This is a sketch of the enum-based Value dispatch (#925), not of an indexable ValueSet.

davidbarsky commented 4 years ago

Whoops, fixed. Sorry about that!

hawkw commented 4 years ago

Okay, I talked it over with @carllerche a bit, and I think that the proposal for this is basically:

(note that Value will probably also stop being a trait object, but I didn't reflect that above because that's a separate issue, #925)