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

Add watch::Sender::send_replace #3962

Merged
merged 1 commit into from Sep 25, 2021

Conversation

SabrinaJewson
Copy link
Contributor

@SabrinaJewson SabrinaJewson commented Jul 16, 2021

Motivation

The tokio::sync::watch channel currently requires that each value sent into the channel is completely independent, but this means that the buffers of old values cannot be reused.

Solution

Add send_replace which allows the sender to retrieve the previous value that was in the channel. The naming is inspired by mem::replace.

@Darksonn Darksonn added A-tokio M-sync labels Jul 17, 2021
Copy link
Contributor

@Noah-Kennedy Noah-Kennedy left a comment

This seems fine.

@Darksonn Darksonn merged commit dee3236 into tokio-rs:master Sep 25, 2021
29 checks passed
suikammd pushed a commit to suikammd/tokio that referenced this issue Oct 7, 2021
jlebon added a commit to jlebon/ostree-rs-ext that referenced this issue Jun 24, 2022
We use `Sender::send_replace` which was added in 1.13.0:
tokio-rs/tokio#3962

Closes: ostreedev#316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio M-sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants