Skip to content

Add minimal examples demonstrating Formatters#600

Merged
djc merged 1 commit intoconsole-rs:mainfrom
Chris--B:formatter-doc-tests
Nov 1, 2023
Merged

Add minimal examples demonstrating Formatters#600
djc merged 1 commit intoconsole-rs:mainfrom
Chris--B:formatter-doc-tests

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
Member

@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
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.

2 participants