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
piper::Sender::send
does not have a struct equivalent
#6
Comments
Looks like modules from piper are from async_std. You can just import them directly. Does something this work for you? fn main() -> io::Result<()> {
smol::run(async {
let (s, r) = async_std::sync::channel(1);
smol::Task::spawn( async move {s.send(2).await;} ).await;
let x = r.recv().await;
Ok(())
})
} |
I'm trying to avoid having to spawn a new task. I've started translating the current code into a |
I empathize with having to box futures to get a concrete type. This will get easier once the language supports Instead of using let (s, r) = piper::chan(1);
let fut: BoxFuture<'_, ()> = s.send("hello").boxed();
fut.await;
They're based on async-std's implementation of channels, but improved in many ways. For example, piper's channels can have capacity of zero. There's also |
This is something that will be solved by |
I can't seem to figure out a way to send a message on a channel without boxing. Is there something I'm missing?
The text was updated successfully, but these errors were encountered: