3,902 questions
0
votes
0
answers
162
views
How to express type bound for future capturing lifetime of parameter
I am trying to store a function for<'a> FnOnce(&'a Data) -> (impl Future + 'a), but unfortunately we cannot express this as impl Future is not allowed in this position. I tried to ...
4
votes
0
answers
139
views
Is `boundary`/`break` fundamentally incompatible with `Future`-based concurrency?
I'm on Scala 3.8.2 / JDK 21 and trying to combine boundary/break with Future to bail out of a parallel operation as soon as the first failure hits.
Here's a stripped-down version. Synchronous boundary/...
0
votes
1
answer
135
views
Flutter: SharedPrefs is not setup in time on real devices
I have this app that before the main page is constructed, I have a FutureBuilder that does some setup on the SharedPreferences that must happen before anything else. I think I did all that correctly, ...
-1
votes
1
answer
140
views
future module in debian
I want to use this app. As it is mentioned in the README.md it needs the future module of python. I have debian sid and python3-future is removed from the repos of apt. When I install it via its setup....
1
vote
1
answer
78
views
Behaviour of vertx Future.all
With Vertx futures, we have
CompositeFuture fRes1 = Future.all(f1, f2, f3);
CompositeFuture fRes2 = Future.join(f1, f2, f3);
Future.join will wait for all three underlying futures to fail to then ...
0
votes
1
answer
168
views
How can I create a single function in Rust that accepts both sync fn and async fn?
I’m building a small web server in Rust and I want the server’s add_route method to accept both synchronous and asynchronous handlers ergonomically.
Goal: allow end-users to write code as simple as:
//...
-1
votes
1
answer
61
views
Animation fails in debug mode app despite check and wait for widget addition to widget tree
I am using expandable_page_view as in the following code setup. Initially when I coded the code in First attempt in the initState method, now commented, the code ran as expected in the real Android ...
0
votes
1
answer
122
views
Return timing of dart `Future` objects in asynchrounous functions
First, Please correct me anything I inferred about asynchrounous programming in dart, and even what I summarized from the docs,
And please check if my idea about when Future objects are correct. I ...
0
votes
1
answer
118
views
Block execution till a Rust future is resolved on WASM without wasm bindgen
I am using a library (Macroquad) that has an async function with following signature:
async fn load_file(path: &str) -> Vec<u8>
This loads the file and returns the raw bytes.
Is there a ...
3
votes
1
answer
99
views
How to cancel a task which includes a file operation?
Reproducible code snippet:
#[tokio::main]
async fn main() {
let (tx, rx) = oneshot::channel();
let a = tokio::spawn(async move {
tokio::select! {
_ = rx => {}
...
0
votes
1
answer
98
views
Async calls to CLI tool in separate folders
I like to call a command line utility from R and parallelise the tool by calling several copies of it in different folders. Each call can have quite different runtimes, so I'd like to do this in an ...
1
vote
1
answer
130
views
Usage of options(warn=2) and tryCatch() with purrr R library
I am most likely not doing the right thing below, why do I get different answers?
library(furrr)
fu=function(x){
options(warn=2)
b=x
tryCatch({b=as.numeric('b')},error=function(e){})
options(...
0
votes
0
answers
85
views
scala's future block cannot access variables from outside
I'm learning Scala futures and I got stuck (or deadlocked) at this piece of code:
package exercises.ch4
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration....
2
votes
2
answers
256
views
Can't make `future` work in parallel and concurrently on several (logical) cores
Within a Shiny app, a task that is triggered by a button is taking quite a long time to complete (synchronous sequential code).
That's why I want to split this task over several (logical) cores of my ...
0
votes
1
answer
62
views
How can I properly get data from an API using http.get in Dart?
I'm new to Dart and I'm trying to get data from an API using the http package.
Here's my code:
import 'dart:convert';
import 'package:http/http.dart' as http;
void fetchData() {
try {
final ...