Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using tokio for parallelism & async #20

Open
JosiahParry opened this issue Mar 21, 2024 · 0 comments
Open

Using tokio for parallelism & async #20

JosiahParry opened this issue Mar 21, 2024 · 0 comments

Comments

@JosiahParry
Copy link
Contributor

This section covers how to utilize async functions with tokio.

Example use case: calling an API endpoint to get many requests in parallel.

Structure:

  1. Define a response struct with serde
  2. Create an async function to query the endpoint using async reqwest
  3. Wrapper function to spawn many tasks in parallel second example (https://docs.rs/tokio/latest/tokio/task/fn.spawn.html#examples?)
  4. create an extendr function with a runtime to evaluate the async function in a blocking context.

This can be taught in a progressive manner as individual sections

@CGMossa CGMossa transferred this issue from extendr/user-guide-old Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant