Files
wasmtime/crates
Jakub Konka 5024d7bf09 [wiggle] Impl different formatters for flags (#1299)
* Impl different formatters for flags

Rather than forcing only binary formatting of flags types, how about
we implement all relevant traits (`Binary`, `Octal`, `LowerHex`, and
`UpperHex`) and allow the user to pick the most relevant one for their
use case?

Also, we use at least `Octal` and `LowerHex` in a couple of places
in `wasi-common`.

* fmt::Display for flags now inspired by bitflags

Flags is now by default formatted similarly to how
`bitflags` crate does it, namely, `dsync|append (0x11)`. In case
we're dealing with an empty set, we get `empty (0x0)`. Because of
this, any `Octal`, `LowerHex`, etc., formatters are redundant now.

Furthermore, while here, I've rewritten `EMPTY_FLAGS` and `ALL_FLAGS`
(where the former means `0x0` and the latter is the union of all possible
values) to be `const fn empty()` and `const fn all()` where the latter is
an expanded union of primitive representation values out of a macro.
This is again largely inspired by the `bitflags` crate.

* Test fmt::Display for flags
2020-03-13 12:27:34 -07:00
..
2020-02-26 16:19:12 -06:00
2020-03-06 11:08:13 -08:00