Skip to content

Using tokio for parallelism & async  #20

@JosiahParry

Description

@JosiahParry

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions