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

Add minimal examples demonstrating Formatters #600

Merged
merged 1 commit into from Nov 1, 2023

Conversation

Chris--B
Copy link
Contributor

This change adds some doc tests to show off what the formatter looks like. This change adds it for just the byte variants:

  • HumanBytes, which seems to forward to BinaryBytes?
  • DecimalBytes, 1 MB == 1 * 10**6 bytes
  • BinaryBytes, 1 MiB == 1 * (1 << 20) bytes

I wanted to know what these formatters look like, preferably from the docs. This is the simplest way that comes to mind, but I'm open to doing this differently if there's alternatives. I only did the Byte variants with this. I'm happy to work on the others but want to make sure this direction is accepted first.

Here's what my local rustdoc docs look like after this change:
image

These also double as tests, and cargo test will fail if their behavior changes.

This change adds some doc tests to show off what the formatter looks like.
This change adds it for just the byte variants:
- `HumanBytes`, which seems to forward to `BinaryBytes`?
- `DecimalBytes`, 1 MB == 1 * 10**6 bytes
- `BinaryBytes`, 1 MiB == 1 * (1 << 20) bytes
Copy link
Collaborator

@djc djc left a comment

Choose a reason for hiding this comment

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

Thanks!

@djc djc merged commit 678e8aa into console-rs:main Nov 1, 2023
10 checks passed
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.

None yet

2 participants