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

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 Area: The main tokio crate M-sync Module: tokio/sync labels Jul 17, 2021
Copy link
Contributor

@Noah-Kennedy Noah-Kennedy left a comment

Choose a reason for hiding this comment

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

This seems fine.

@Darksonn Darksonn merged commit dee3236 into tokio-rs:master Sep 25, 2021
suikammd pushed a commit to suikammd/tokio that referenced this pull request Oct 7, 2021
jlebon added a commit to jlebon/ostree-rs-ext that referenced this pull request 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 Area: The main tokio crate M-sync Module: tokio/sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants