Skip to content

Rename Sink::poll_complete to flush #747

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

Merged
merged 1 commit into from
Feb 10, 2018
Merged

Conversation

alexcrichton
Copy link
Member

Along with a few other changes:

  • Move the Sink::flush combinator to a free flush function
  • Add a free close combinator

Closes #379

Along with a few other changes:

* Move the `Sink::flush` combinator to a free `flush` function
* Add a free `close` combinator

Closes #379
@alexcrichton alexcrichton requested a review from cramertj February 9, 2018 21:17
/// Get a shared reference to the inner sink.
/// Returns `None` if the sink has already been closeed.
pub fn get_ref(&self) -> Option<&S> {
self.sink.as_ref()
Copy link
Contributor

Choose a reason for hiding this comment

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

Some combinators return &S here instead and panic when sink is None. Is there a reason why there are two patterns?

Copy link
Member

Choose a reason for hiding this comment

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

All of the as_ref/get_ref/get_mut style combinators return Option. Future implementations panic if they are polled after completion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed! And to clarify, @ahmedcharles if you find inconsistencies where we panic then that's a bug we should fix!

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok thanks, I fixed that in 8689770

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.

3 participants