Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add a Debug implementation for Graphemes and so on #95

Closed
ChaiTRex opened this issue Apr 17, 2021 · 2 comments · Fixed by #131
Closed

Please add a Debug implementation for Graphemes and so on #95

ChaiTRex opened this issue Apr 17, 2021 · 2 comments · Fixed by #131

Comments

@ChaiTRex
Copy link

The std::str::Chars iterator has a nice Debug output:

fn main() {
    let mut chars = "abc".chars();
    println!("{:?}", chars);
    chars.next();
    println!("{:?}", chars);
}

produces:

Chars(['a', 'b', 'c'])
Chars(['b', 'c'])

It would be nice to see unicode_segmentation::Graphemes and so forth implement a nice Debug output to display what they're going to be producing in the future.

timClicks added a commit to timClicks/unicode-segmentation that referenced this issue Jun 2, 2021
@timClicks
Copy link
Contributor

One of the complications with Debug is that, by default, it exposes lots of internals. Graphenes holds a lot of state, and so its Debug output is quite ugly.

I've submitted #98 anyway. Let's see what the maintainers think

Manishearth added a commit that referenced this issue Jun 2, 2021
@Manishearth
Copy link
Member

Yeah, we could improve the debug impl but for now this one is fine

syvb added a commit to syvb/unicode-segmentation that referenced this issue Feb 21, 2024
Some types in this crate don't have Debug implemented, but it's annoying
to use a non-Debug type in a struct with Debug derived. I just used the
automatic impl from `#[derive(Debug)]` for all of these (although in the
future it might be good to have custom implementations for types with
complex internals).

Closes unicode-rs#95.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants