#api #rest #http #exercism

mini_exercism

Minimalistic Rust library to interact with the Exercism.org APIs

5 stable releases

2.1.0 Jan 15, 2024
2.0.0 Jan 2, 2024
1.2.0 Nov 13, 2023
1.1.0 Oct 14, 2023
1.0.0 Sep 16, 2023

#404 in Asynchronous

Download history 38/week @ 2023-10-28 45/week @ 2023-11-04 116/week @ 2023-11-11 27/week @ 2023-11-18 52/week @ 2023-11-25 60/week @ 2023-12-02 32/week @ 2023-12-09 59/week @ 2023-12-16 32/week @ 2023-12-23 112/week @ 2023-12-30 46/week @ 2024-01-06 248/week @ 2024-01-13 59/week @ 2024-01-20 42/week @ 2024-01-27 69/week @ 2024-02-03 51/week @ 2024-02-10

222 downloads per month

MIT license

130KB
2K SLoC

mini_exercism

CI codecov Security audit crates.io downloads docs.rs Contributor Covenant

Minimalistic Rust library to interact with the Exercism.org APIs.

Exerci-what?

Exercism is a free, not-for-profit platform to learn new programming languages. It supports a web editor for solving exercises, mentoring with real humans and a lot more. For more information, see its about page.

Installing

Add mini_exercism to your dependencies:

[dependencies]
mini_exercism = "2.1.0"

or by running:

cargo add mini_exercism

Example

use mini_exercism::api;
use mini_exercism::api::v2::exercises::Filters;
use mini_exercism::core::Credentials;

async fn get_published_solution_uuids(
    api_token: &str,
    track: &str,
) -> anyhow::Result<Vec<String>> {
    let credentials = Credentials::from_api_token(api_token);
    let client = api::v2::Client::builder().credentials(credentials).build();

    let filters = Filters::builder().include_solutions(true).build();
    let solutions = client.get_exercises(track, Some(filters)).await?.solutions;

    Ok(solutions
        .into_iter()
        .filter(|solution| solution.published_at.is_some())
        .map(|solution| solution.uuid)
        .collect())
}

For more information, see the docs.

Minimum Rust version

mini_exercism currently builds on Rust 1.63 or newer.

Dependencies

~5–19MB
~279K SLoC