Skip to content

Implement fmt::Display for Pid, Uid, Gid #1449

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rusty-snake
Copy link
Contributor

Closes #1439

@evilpie
Copy link

evilpie commented Apr 21, 2025

It might be nice to implement more formatters like UpperHex. e.g. https://doc.rust-lang.org/src/core/num/nonzero.rs.html#136-153

@@ -87,6 +87,12 @@ impl Pid {
}
}

impl fmt::Display for Pid {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
Copy link

Choose a reason for hiding this comment

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

Suggested change
write!(f, "{}", self.0)
self.0.fmt(f)

This makes some of the custom alignments etc. work.

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.

impl core::fmt::Display for Pid, Uid, Gid?
2 participants