4 ms·
Can it parse Rust debug output (dbg!() or {:?}) back into original data?
by pzmarzly 4y ago
Can it parse Rust debug output (dbg!() or {:?}) back into original data?
- the_mitsuhiko 4y agoUsually not, because Rust's debug output is largely unstructured. There are some projects that are trying to do it though: https://crates.io/crates/darrentsung_debug_parser https://crates.io/crates/darrentsung_debug_parser
- codeflo 4y agoIt’s not intended to do that, and I don’t think that would be possible in general. Debug output can be arbitrary and ambiguous, while this is a well-defined serialization format that only happens to have a readable Rust-like syntax. Of course you’re always free to use RON in place of debug output for logging purposes.
- junon 4y agoI could output `ksdjflaskjdflkajsdf` every time my custom structure is Display'd or Debug'd. There's no sense in trying to parse that output.