-
Notifications
You must be signed in to change notification settings - Fork 734
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
Make format::Writer::new() public #2680
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7cf745c
Make format::Writer::new() public
kaifastromai 76a4fbd
Merge pull request #1 from kaifastromai/kaifastromai-public-writer-new
kaifastromai 22739de
fix typo in doc comment
cephas-storm-bfx 3307207
Merge branch 'master' into master
hawkw 336a36b
Apply suggestions from code review
hawkw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're committing to making this a public API, I think we can just remove the previous TODO comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation for not making this public is that I thought it could be valuable for the
Writer
type to be able to indicate whether it was empty or not. This could be used when writing to it, in order to determine whether to emit whitespace before writing more text to the writer. If we were going to track this, however, we couldn't just take an arbitraryimpl fmt::Write
, because there is no way to determine whether that value is empty or not. If we had an explicitWriter::from_string
constructor, instead, we could check if the string is empty first. Therefore, my preference would be to do that, and keep thenew
function that constructs aWriter
from an arbitrary value private.However, I honestly don't care anymore, and I'm happy to approve this PR regardless. If we decide that tracking whether the writer is empty is important, we could make a breaking change in the future.