Types should be optionally emitted with trace_fmt
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
Currently (or very soon when some in progress change lands), trace_fmt emits untyped literal values:
```
trace_fmt!("myvalue = {:#x}", myvalue)
// myvalue = 0xbeef
````
It'd be nice to have a way of emitting the type as well, maybe via an additional character in the format string:
```
trace_fmt("myvalue = {:#xt}, my value)
// myvalue = u42:0xbeef
```
This has the advantage of making the values parsable which is nice for cut and pasting large data structures emitted via trace_fmt into test code. Also, printing the types (of course) reveals to the user what the types actually are which is not always obvious.
Also, it'd be super cool if you could actually emit the type alias:
```
trace_fmt("myvalue = {:#xt}, my value)
// myvalue = MyModule::MyType:0xbeef
```
and perhaps a mode which gives you the type alias and the underlying type:
```
trace_fmt("myvalue = {:#xT}, my value)
// myvalue = MyModule::MyType:0xbeef (u42)
```
Contributor guide
Assessment
This issue has not been assessed yet.