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 From<Receiver<T>> impl for receiver streams #4080

Merged
merged 2 commits into from
Aug 29, 2021

Conversation

FrancisMurillo
Copy link
Contributor

Motivation

Receiver streams can be better created via From trait.

Solution

Add From<Receiver<T>> implementation for streams that take a Receiver.

Note: Should other streams implement the From trait as well?

Resolves #4015

@Darksonn Darksonn added the A-tokio-stream Area: The tokio-stream crate label Aug 29, 2021
@@ -94,3 +94,9 @@ impl<T> fmt::Debug for WatchStream<T> {
f.debug_struct("WatchStream").finish()
}
}

impl<T: 'static + Clone + Unpin + Send + Sync> From<Receiver<T>> for WatchStream<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the Unpin here and from the new function?

@Darksonn Darksonn added the M-sync Module: tokio/sync label Aug 29, 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.

Thanks.

@Darksonn Darksonn merged commit 909d3ec into tokio-rs:master Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-stream Area: The tokio-stream crate M-sync Module: tokio/sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tokio-stream] Implement From<Receiver> for ReceiverStream (and maybe others)
2 participants