Wasm-bindgen: Custom `Debug` implementations for js_sys::*

Created on 7 Jan 2019  路  3Comments  路  Source: rustwasm/wasm-bindgen

It would be nice when debugging if you could get more information about the contents of a javascript object, etc. Debug could be implemented to iterate over its own properties and use f.debug_map to print them.

Same applies to other built-in javascript objects.

Most helpful comment

This sounds like a great idea to me, and I think we could take a PR for these at any time!

All 3 comments

This sounds like a great idea to me, and I think we could take a PR for these at any time!

I've implemented something in #1161, I'm seeing how it works out in practice and it seems to be good.

It basically tries to json-encode the object, and if that's not possible use toString to get something.

We've already added a few of these so I'm going to close this, and more are of course welcome at any time!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarcAntoine-Arnaud picture MarcAntoine-Arnaud  路  3Comments

NateLing picture NateLing  路  3Comments

expobrain picture expobrain  路  4Comments

aschampion picture aschampion  路  4Comments

d3lm picture d3lm  路  3Comments