Add missing spawn_local method to Scope in the single threaded executor case (#1266)
This commit is contained in:
parent
50ceaf3559
commit
1e8060a5a2
@ -127,6 +127,10 @@ pub struct Scope<'scope, T> {
|
|||||||
|
|
||||||
impl<'scope, T: Send + 'scope> Scope<'scope, T> {
|
impl<'scope, T: Send + 'scope> Scope<'scope, T> {
|
||||||
pub fn spawn<Fut: Future<Output = T> + 'scope + Send>(&mut self, f: Fut) {
|
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));
|
let result = Arc::new(Mutex::new(None));
|
||||||
self.results.push(result.clone());
|
self.results.push(result.clone());
|
||||||
let f = async move {
|
let f = async move {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user