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

Implement Debug for File #65

Merged
merged 2 commits into from
Nov 16, 2021

Conversation

matthiasbeyer
Copy link
Contributor

Closes #58

Feel free to suggest improvements. From what I can see right now, it is not possible to generate the same output as the Debug implementation for std::fs::File... or am I missing something?

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
src/fs/file.rs Outdated
Comment on lines 339 to 343
impl fmt::Debug for File {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "File {{ fd: {fd} }}", fd = self.fd.raw_fd())
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use debug_struct so that we properly handle it when the user pretty-prints the debug output.

@matthiasbeyer
Copy link
Contributor Author

Like this? (I'll squash if you approve!)

Copy link

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine. You don't need to squash the PR - all PRs are automatically squashed on merge.

@matthiasbeyer
Copy link
Contributor Author

ugh.

@Darksonn Darksonn merged commit ed6856a into tokio-rs:master Nov 16, 2021
@matthiasbeyer matthiasbeyer deleted the implement-file-debug branch November 16, 2021 15:16
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 this pull request may close these issues.

File should implement Debug
2 participants