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

unable to use poll_next() from Channel's Stream impl (with futures_core enabled, possibly two runtimes conflict?) #33

Open
smokytheangel0 opened this issue May 31, 2023 · 4 comments

Comments

@smokytheangel0
Copy link

smokytheangel0 commented May 31, 2023

Describe the bug
Unable to use .poll_next() on a Channel<Option>.

To Reproduce
Steps to reproduce the behavior:

  1. Add crate whisk, version 0.11.0, with features futures_core
  2. Add crate tokio, version 1.28.2, features: rt-multi-thread, macros
  3. Create channel with Channel::new()
  4. clone channel and give clone to tokio async task (two runtimes?, am not using async::main)
  5. no method 'poll_next' found for struct 'Channel<Option>' (the original channel pointer)

Expected behavior
the method 'poll_next' returns an option within a for loop:
Some(VideoUpdate)
or None for channel has been cleared

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot from 2023-05-31 12-45-06

Desktop (please complete the following information):

  • OS: [e.g. iOS]
    Linux 5.15.0-71-generic #78~20.04.1-Ubuntu SMP Wed Apr 19 11:26:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Additional context
I am pretty new to programming but I imagine there could be some conflicts between two async runtimes pasts and tokio,
I aim for my crate to be easily made nostd, but also trying to balance that with readability to a client who does not understand
the details, so using tokio's task and writing it like a thread spawn with task::spawn is very nice, and I would love to be able to
understand more about how I would create a similar interface using only pasts as nostd is the end goal.

@smokytheangel0
Copy link
Author

Just tried it without tokio, just using pasts::Executor which wasn't so hard to dress up. Same error, I suppose I am just not understanding Streams somehow.

@AldaronLau
Copy link
Member

@smokytheangel0 Thanks for opening an issue!

I can't tell what's going on with your code with the context given.

I wrote up a whisk + tokio example following your steps and could not reproduce the issue. Maybe it will be helpful?

@AldaronLau
Copy link
Member

understand more about how I would create a similar interface using only pasts as nostd is the end goal.

I just realized that whisk has a bug, where if you enable the pasts feature, whisk won't run on no-std anymore (because it pulls in the pasts/std feature). I'll work on fixing it and making a no-std example.

@AldaronLau
Copy link
Member

AldaronLau commented Jun 2, 2023

understand more about how I would create a similar interface using only pasts as nostd is the end goal.

I just realized that whisk has a bug, where if you enable the pasts feature, whisk won't run on no-std anymore (because it pulls in the pasts/std feature). I'll work on fixing it and making a no-std example.

I fixed the bug, and released whisk 0.12.0. Also created a no-std binary example here.

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

No branches or pull requests

2 participants