Add missing spawn_local method to Scope in the single threaded executor case (#1266)

This commit is contained in:
Alec Deason 2021-01-19 13:07:45 -08:00 committed by GitHub
parent 50ceaf3559
commit 1e8060a5a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,6 +127,10 @@ pub struct Scope<'scope, T> {
impl<'scope, T: Send + 'scope> Scope<'scope, T> {
pub fn spawn<Fut: Future<Output = T> + 'scope + Send>(&mut self, f: Fut) {
self.spawn_local(f);
}
pub fn spawn_local<Fut: Future<Output = T> + 'scope>(&mut self, f: Fut) {
let result = Arc::new(Mutex::new(None));
self.results.push(result.clone());
let f = async move {