3Hren / 3Hren/msgpack-rust

Display vs. Debug

Open
#152 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.4k
Forks
162
PR merge metrics
No merged PRs in 30d

Description

Hey!

First of all, thanks for this lib! I'm using neovim-lib, which builds upon this :)

While thinking about [an issue](https://github.com/daa84/neovim-lib/issues/12) I opened at neovim-lib, I went to look at the debug/display implementations for `Value`. I noticed they're basically the same, and this is somewhat connected to my issue. The short version is that I'm pushing large data over msgpack, and the debug representation taxes my log quite a bit.

So, is this intentional that display/debug are so similar? I don't know what's best pratice here, but to me it seems they should offer something different, otherwise why have both? I'm kinda imagining that one of both should not fully print the value recursively, but output information on the Value, i.e. the type, maybe the length (if applicable). I'm not sure which though, since I imagine `display` should be used for human readability, and in my case a 67MB string on one line isn't really that. But not outputting the contained value on `display`, but doing so on `debug` sounds weird as well.

I do not have a real proposition, but would like to hear your opinion on that. I'd want to link https://doc.rust-lang.org/std/fmt/#sign0, which shows that more fine-grained behaviour would be possible, too. I'd be open to making a PR for whatever-we-figure-out-is-best (if it comes to that, no pressure, I'm just interested mainly).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.