mealdb

Crates.iomealdb
lib.rsmealdb
version0.1.1
sourcesrc
created_at2021-06-29 05:44:34.278352
updated_at2021-06-29 05:51:29.373524
descriptionAsync API wraper for themealdb.com
homepagehttps://github.com/theunkn0wn1/themealdb-rs
repository
max_upload_size
id416029
size82,132
Joshua Salzedo (theunkn0wn1)

documentation

README

mealdb-rs

This rust crate provides a reqwest-based async interface to themealdb.com.

Usage

Currently, this crate only supports the json API v1 endpoints.

To use this crate, instantiate an instance of the API wrapper.

use mealdb::preamble::*;

#[tokio::main]
pub async fn main() {
    println!("hello, world!");

    // Create handle to the API
    let api = mealdb::V1::new("https://www.themealdb.com", "<YOUR API KEY HERE>");
    // ...
    }

this V1 api wrapper exposes the supported methods of themealdb's API.

For example, getting all the meals with a title containing chicken:

    // Searching for meals that contain a keyword
    println!("finding all meals with `chicken` in the name...");
    let meals = api
        .search_meal_by_name("chicken")
        .await
        .expect("query failed.")
        .expect("no results.");
    meals
        .iter()
        .for_each(|meal| println!("meal name :: {:?} meal id :: {}", meal.name, meal.id));

Commit count: 0

cargo fmt