Crates.io | mal |
lib.rs | mal |
version | 0.8.1 |
source | src |
created_at | 2018-01-08 13:03:11.277842 |
updated_at | 2018-04-27 09:28:11.603224 |
description | A library to interact with the MyAnimeList API. |
homepage | |
repository | https://github.com/Acizza/mal-rs |
max_upload_size | |
id | 45948 |
size | 62,628 |
The purpose of this library is to provide high-level access to the MyAnimeList API.
At the time of writing, all features of the API are implemented, which include:
By default, the library builds with support to work with both anime and manga.
If you need to search for / perform operations on both the user's anime and manga list, you can simply add mal
as a dependency to your Cargo.toml
file:
[dependencies]
mal = "0.8"
If you only need to work with just one type of list, you should use the following feature gates to reduce the final binary size and compilation time:
If you only need to search for anime / work with anime on a user's list, use the anime
feature:
[dependencies.mal]
version = "0.8"
default-features = false
features = ["anime"]
If you only need to search for manga / work with manga on a user's list, use the manga
feature:
[dependencies.mal]
version = "0.8"
default-features = false
features = ["manga"]
The following will update an existing anime on a user's list:
extern crate mal;
use mal::MAL;
use mal::list::Status;
fn main() {
// Create a new MAL instance
let mal = MAL::new("username", "password");
// Read the user's anime list
let list = mal.anime_list().read().unwrap();
// Find Toradora in the list entries
let mut toradora = list
.entries
.into_iter()
.find(|e| e.series_info.id == 4224)
.unwrap();
// Set new values for the list entry
// In this case, the episode count will be updated to 25, the score will be set to 10, and the status will be set to completed
toradora.values
.set_watched_episodes(25)
.set_score(10)
.set_status(Status::Completed);
// Update the anime on the user's list
mal.anime_list().update(&mut toradora).unwrap();
}
For more examples, see the docs on docs.rs.