Comments (3)
You can't spawn non static futures on any executor without unsafe. The problem is that you can use std::mem::forget
to leak the nursery, which would then outlive it's parent scope, which might hold the pointed to value. Thus when the stack frame ends, that value get's dropped, but the nursery can outlive it and still run code that has a reference to that memory. That is a memory safety issue which is not allowed in safe rust.
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)
from async_nursery.
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.
from async_nursery.
Thanks!
from async_nursery.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async_nursery.