File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -45,4 +45,25 @@ impl DBusMethodInvocation {
45
45
Err ( error) => self . return_gerror ( error) ,
46
46
}
47
47
}
48
+
49
+ // rustdoc-stripper-ignore-next
50
+ /// Return an async result for this invocation.
51
+ ///
52
+ /// Spawn the given future on the thread-default main context, and return the
53
+ /// the result with [`return_result`]. Specifically, if a variant is returned
54
+ /// that is not a tuple it is automatically wrapped into a tuple.
55
+ ///
56
+ /// The given `Future` does not have to be `Send`.
57
+ ///
58
+ /// This can be called only from the thread where the main context is running, e.g.
59
+ /// from any other `Future` that is executed on this main context, or after calling
60
+ /// `with_thread_default` or `acquire` on the main context.
61
+ pub fn return_future_local < F > ( self , f : F ) -> glib:: JoinHandle < ( ) >
62
+ where
63
+ F : std:: future:: Future < Output = Result < Option < glib:: Variant > , glib:: Error > > + ' static ,
64
+ {
65
+ glib:: spawn_future_local ( async move {
66
+ self . return_result ( f. await ) ;
67
+ } )
68
+ }
48
69
}
You can’t perform that action at this time.
0 commit comments