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

Support separate formatters, overriding skip for pretty printing mode #13

Open
mzabaluev opened this issue Jun 11, 2020 · 2 comments
Open

Comments

@mzabaluev
Copy link

mzabaluev commented Jun 11, 2020

It would be nice to be able to declare different formatting for the pretty printing representation.
For example, fields that are skipped in normal mode could be printed in the pretty mode:

#[derive(CustomDebug)]
TestingError {
     message: String,
     #[debug(skip)]
     #[pretty]
     logs: Vec<String>,
}
@panicbit
Copy link
Owner

I like this idea, but I'll have to think about how I want this to work.

@mzabaluev
Copy link
Author

I think it would be fine if the pretty field attribute accepted the same parameters as debug, except that the default pretty formatting would be taken from the debug attribute if present on the field, and pretty without arguments would invoke the default Debug formatting in the alternate mode even if debug(skip) is present.

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

No branches or pull requests

2 participants