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

Make Selector reusable #39

Open
oblique opened this issue Sep 3, 2020 · 3 comments
Open

Make Selector reusable #39

oblique opened this issue Sep 3, 2020 · 3 comments

Comments

@oblique
Copy link

oblique commented Sep 3, 2020

A common pattern is to use Selector in an infinite loop.
Now a user need to reconstruct a new Selector in each iteration because wait consumes it.
This can have performance impact in high load cases.

Is it possible to make wait borrowing self?

@zesterer
Copy link
Owner

zesterer commented Sep 3, 2020

Yes, in theory. A few changes need to be made to support that use-case, however. I'll add that to my to-do list for the next few days.

@saiintbrisson
Copy link

saiintbrisson commented Aug 23, 2023

Hi @zesterer! I'm willing to try and work this out. I've checked things here and have a decent idea of how to implement it, but maybe you could give me some directions on what you think should be changed.

I also came up with a sketch of an OwnedSelector that consumes owned receivers instead of references and is able to be stored in structs without needing lifetimes or 'static leakages, but I'm not sure this is desired. This removes the need to box the selection every time the selector is built.

But maybe this could be done by having the channel_macro! do everything on the stack.

@zesterer
Copy link
Owner

Hi @zesterer! I'm willing to try and work this out. I've checked things here and have a decent idea of how to implement it, but maybe you could give me some directions on what you think should be changed.

I also came up with a sketch of an OwnedSelector that consumes owned receivers instead of references and is able to be stored in structs without needing lifetimes or 'static leakages, but I'm not sure this is desired. This removes the need to box the selection every time the selector is built.

But maybe this could be done by having the channel_macro! do everything on the stack.

Hi, I can definitely see this working out! Did you have more details about what sort of implementation & API you'd likely be looking to go for?

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

3 participants