5 releases
0.1.0 | Oct 26, 2021 |
---|---|
0.0.5 | Oct 26, 2021 |
0.0.3 | Oct 20, 2021 |
0.0.2 | Oct 20, 2021 |
0.0.1 | Oct 20, 2021 |
#5 in #co
11KB
276 lines
Rust Swapi Client
Rust client for Star Wars API (https://swapi.co/)
Usage
Add this to your Cargo.toml
:
[dependencies]
swapi_client = "0.1.0"
Example Usage:
use swapi_client::RequestHandler;
use swapi_client::{Film, People, Planet, Species, Starship, Vehicle};
// Get Planet object
Planet::get(10);
// Get Planets
let planet_list = Planet::list(Some(2)).unwrap();
// Check list data has prev or next pagination
planet_list.has_next();
planet_list.has_prev();
// Query to next or prev pagination, return Option<Box<ListData>>
planet_list.next();
planet_list.prev();
// Iterate from list data
for planet in planet_list.into_iter() {
println!("Planet: {}", planet.name);
}
lib.rs
:
Rust client for Star Wars API
Dependencies
~5–16MB
~220K SLoC