billyrieger / bimap-rs

Generic bijective maps in Rust
Apache License 2.0
129 stars 26 forks source link

Alternate debug formatter (for pretty printing) not implemented #8

Closed dmarcuse closed 4 years ago

dmarcuse commented 5 years ago

When formatting a bimap using the debug formatter, the alternate flag (:#? instead of :?) isn't considered, and the output is still written as one long line. I'm happy to write a PR to implement this, but there's one minor consideration first - std provides a DebugMap helper to automatically handle indentation consistently, but using it would mean that the output is generated with : separating keys and values, as opposed to <>. Any thoughts?

billyrieger commented 5 years ago

Sorry for the slow reply, my computer was out of commission for a while. I totally forgot about pretty-printing debug formatting but it's something I'd definitely like to see in the library. I'd prefer to continue using <> as a separator to keep it consistent with the standard debug representation. It shouldn't be too difficult to just manually print it line by line, with something like write!(f, "{:?} <> {:?},", left, right) for each (left, right) pair.

kaikalii commented 4 years ago

I've implemented this in #14.

billyrieger commented 4 years ago

Closed by #14.