Expand description
§rick_and_morty
The rick_and_morty crate provides a wrapper around rickandmortyapi.com
It exports all the basic entities available from the api:
Each module provides: get, get_all, get_multiple for equvailent REST endpoints and matching structs.
The structs also have helper methods for getting related entities.
For example Character.origin() method returns a Location object.
All provided functions/methods are asynchronous:
§Examples:
- Getting all characters:
use rick_and_morty as rm;
async fn get_characters() -> () {
let c = rm::character::get_all().await;
match c {
Ok(res) => println!("{:?}", res),
Err(e) => println!("{:?}", e),
}
}- Getting a single location:
use rick_and_morty as rm;
async fn get_location() -> () {
let c = rm::location::get(1).await;
match c {
Ok(res) => println!("{:?}", res),
Err(e) => println!("{:?}", e),
}
}Modules§
- character
charactermod provides struct and functions for querying characters- episode
episodecontains Struct and helper functions for episodes in the rick and morty api.- location
locationmodule contains struct and functions for managing locations in the Rick And Morty Universe.
Structs§
- Error
- The Errors that may occur when processing a
Request. - Info
- data about the page
- Object
Objectis a convenient wrapper for json objects returned from API for related entities.- Page
Response PageResponseis a helper struct matching the shape of the returned json object when a call returned paginated results.