| Crates.io | swapi_client |
| lib.rs | swapi_client |
| version | 0.1.0 |
| created_at | 2021-10-20 05:38:42.889424+00 |
| updated_at | 2021-10-26 04:41:19.734098+00 |
| description | Rust client for Star Wars API (https://swapi.co/) |
| homepage | |
| repository | |
| max_upload_size | |
| id | 467730 |
| size | 11,561 |
Rust client for Star Wars API (https://swapi.co/)
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);
}