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

Exposing write_buffer on FramedWrite/Framed for consistency with FramedRead #3387

Merged

Conversation

craftytrickster
Copy link
Contributor

Motivation

I have a scenario where given a specific event trigger, I need to consider all data in my Framed object is invalid, and I need to clear all of it. The framed object already exposes the read_buffer, I am just exposing the corresponding write buffer, so that I can clear that data as well.

Solution

Copying the API used for read_buffer in the FramedWrite/Framed files as well.

…e consistent with the exposed read_buffer methods
@Darksonn Darksonn added A-tokio-util Area: The tokio-util crate M-codec Module: tokio-util/codec labels Jan 6, 2021
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Seems good to me.

@Darksonn Darksonn merged commit 2fe2f04 into tokio-rs:master Jan 8, 2021
@craftytrickster craftytrickster deleted the framed_expose_write_buf_mut branch January 8, 2021 22:46
tesaguri added a commit to tesaguri/tokio that referenced this pull request Jan 10, 2021
- codec: `get_ref()`, `get_mut()`, `get_pin_mut()` and `into_inner()` for
  `Framed`, `FramedRead`, `FramedWrite`, `StreamReader`, `StreamReader`,
  `StreamReader` and `StreamReader` (tokio-rs#3364).
- codec: `write_buffer()` and `write_buffer_mut()` for `Framed` and
  `FramedWrite` (tokio-rs#3387).
tesaguri added a commit to tesaguri/tokio that referenced this pull request Jan 10, 2021
- codec: `get_ref()`, `get_mut()`, `get_pin_mut()` and `into_inner()` for
  `Framed`, `FramedRead`, `FramedWrite`, `StreamReader`, `StreamReader`,
  `StreamReader` and `StreamReader` (tokio-rs#3364).
- codec: `write_buffer()` and `write_buffer_mut()` for `Framed` and
  `FramedWrite` (tokio-rs#3387).
tesaguri added a commit to tesaguri/tokio that referenced this pull request Jan 10, 2021
# 0.6.1 (January 10, 2020)

### Added

- codec: `get_ref()`, `get_mut()`, `get_pin_mut()` and `into_inner()` for
  `Framed`, `FramedRead`, `FramedWrite`, `StreamReader`, `StreamReader`,
  `StreamReader` and `StreamReader` (tokio-rs#3364).
- codec: `write_buffer()` and `write_buffer_mut()` for `Framed` and
  `FramedWrite` (tokio-rs#3387).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-util Area: The tokio-util crate M-codec Module: tokio-util/codec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants