-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use shorter lifetimes #1
Comments
You can't spawn non static futures on any executor without unsafe. The problem is that you can use The only crate that can help you here is https://docs.rs/async-scoped which requires you use unsafe. If you want to go that path, I would suggest you use async-scoped. Unless there is some very good arguments for it and it can be implemented cleanly, I don't have any plans to add such an unsafe API to async_nursery. That being said, if you have some very compelling argument, please share. Some more discussion about the issue can be found here: tokio-rs/tokio#1879 (comment) |
ps: I'm adding this to the readme: 6c2620e#diff-04c6e90faac2675aa89e2176d2eec7d8R69 ps2: If you are struggling to design something, don't hesitate to ask. Maybe there's a better way to achieve what you want. |
Thanks! |
Right now, I use the function:
fn nurse( &self, fut: impl Future<Output = Out> + Send + 'static ) -> Result<(), NurseErr>;
This unfortunately means I can't use references in myasync fn
with a lifetime less than'static
, which is quite inconvenient.I'm not really sure of the complexity of changing that, but I'd appreciate any thoughts you have on it.
The text was updated successfully, but these errors were encountered: