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

util: add mutable reference getters for codecs to pinned Framed #4372

Merged
merged 3 commits into from
Jan 3, 2022

Conversation

Freax13
Copy link
Contributor

@Freax13 Freax13 commented Jan 3, 2022

Motivation

Previously it was not possible to get a mutable reference to the codec of a pinned Framed/FramedWrite/FramedRead. This shouldn't be a problem because we never access the codec through a pinned reference.

Solution

This pr adds the mutable reference getters Framed::codec_pin_mut, FramedRead::decoder_pin_mut and FramedWrite::encoder_pin_mut.

The names were inspired by the get_pin_mut getters which return a pinned mutable reference to the underlying io streams. The added getters are slightly different in that they return a normal reference and not a pinned reference, so I'm not completely sure if adapting the same naming scheme is appropriate.

@Darksonn Darksonn added A-tokio-util Area: The tokio-util crate M-codec Module: tokio-util/codec labels Jan 3, 2022
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.

Change seem good.

@Darksonn Darksonn merged commit 4a12163 into tokio-rs:master Jan 3, 2022
@Freax13 Freax13 deleted the codec_pin_mut branch January 4, 2022 09:25
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.

3 participants