Skip to content

Cannot access the "Sender" of a channel #532

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

Closed
mrpink76 opened this issue Nov 14, 2019 · 3 comments
Closed

Cannot access the "Sender" of a channel #532

mrpink76 opened this issue Nov 14, 2019 · 3 comments

Comments

@mrpink76
Copy link

mrpink76 commented Nov 14, 2019

I am having problems passing a sender as a parameter to a function.

The following code:

use async_std::sync::channel;
use async_std::io;
use async_std::prelude::*;
use async_std::task;


fn main() -> io::Result<()> {
    task::block_on(async {
        let (s, r) = channel::<i32>(1);
        let webcam = start_service(&s);
        Ok(())
    })
}

async fn start_service(s : &async_std::sync::channel::Sender<i32>) -> () {
}

gives the following error:

error[E0603]: module `channel` is private
  --> src\main.rs:15:46
   |
15 | async fn start_service(s : &async_std::sync::channel::Sender) -> () {
   |                                              ^^^^^^^

Is it an error or am I using it incorrectly?

Thanks for an awesome crate!

@dignifiedquire
Copy link
Member

it is reexported at the top level async_std::sync::Sender should work.

@mrpink76
Copy link
Author

Awesome! Thanks!

@yoshuawuyts
Copy link
Contributor

@dignifiedquire is right; going to go ahead and close this issue.

However we should probably file a backlink from Sender and Receiver to channel so it becomes a bit more discoverable. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants