Hi! I'm interested in using this library. However, as someone who hasn't done concurrency in rust before, I'm not quite sure how to get started.
The main docs page has this example:
async fn scoped_futures() {
let not_copy = String::from("hello world!");
let not_copy_ref = ¬_copy;
let (foo, outputs) = async_scoped::AsyncStdScope::scope_and_block(|s| {
for _ in 0..10 {
let proc = || async {
assert_eq!(not_copy_ref, "hello world!");
eprintln!("Hello world!")
};
s.spawn(proc());
}
42
});
assert_eq!(foo, 42);
assert_eq!(outputs.len(), 10);
}
But I'm not sure how to execute an async fn. This means as a beginner, I have to go and look at the async-std or tokio docs to understand how to use this library, which is perhaps intended to be an abstraction layer over the top of them.
Hi! I'm interested in using this library. However, as someone who hasn't done concurrency in rust before, I'm not quite sure how to get started.
The main docs page has this example:
But I'm not sure how to execute an
async fn. This means as a beginner, I have to go and look at theasync-stdortokiodocs to understand how to use this library, which is perhaps intended to be an abstraction layer over the top of them.