rust-futures Questions
2
I would like to run something like the following code:
async fn get_user(s: &str) -> Option<User> { /* ... */ }
let user_id = Some("sessiontoken").and_then(|session_token| {...
Err asked 4/11, 2021 at 19:30
2
Solved
I'm facing a scenario where I need to run async code from the drop handler of an object. The whole application runs in a tokio async context, so I know that the drop handler is called with an activ...
Hildy asked 19/3, 2022 at 20:23
1
Solved
I want to do something like this:
// NOTE: This doesn't compile
struct A { v: u32 }
async fn foo<
C: for<'a> FnOnce(&'a A) -> Pin<Box<dyn Future<Output = ()> + 'a>...
Kahn asked 17/6, 2022 at 9:52
1
Solved
Is there a more idiomatic or prettier way to do an operation like this in rust?
let maybe_output = match maybe_input {
Some(input) => Some(async_result(input).await?),
None => None,
};
I ...
Penumbra asked 12/9, 2021 at 19:23
1
Solved
I have the following code
use std::future::Future;
fn main() {
handle(Test::my_func);
}
fn handle<Fut>(fun: for<'r> fn(&'r mut Test) -> Fut) -> bool
where
Fut: Future<Ou...
Plaza asked 9/8, 2021 at 6:36
1
Solved
I'm trying to get data using crates_io_api.
I attempted to get data from a stream, but
I can not get it to work.
AsyncClient::all_crates returns an impl Stream. How do I get data from it? It would ...
Beeswing asked 7/5, 2021 at 13:49
1
© 2022 - 2024 — McMap. All rights reserved.