Skip to content

alexd6631/apod-async-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apod-async-client

Apod async client crate Apod async client documentation Apod async client travis

apod-async-client is a crate providing a simple client for NASA "Astronomy Picture of the Day" API.

The client is based on reqwest and tokio, and requires the tokio reactor to be setup in your application.

use apod_async_client::{APODClient, APODClientError, Date};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), APODClientError> {
    let client = APODClient::new("DEMO_KEY");
    let (metadata, rate_limit) = client.get_picture(&Date::Today, true).await?;
    Ok(())
}

This crate is quite simple, but allowed me to exercise the following points :

  • Learn about Rust asynchronous IO, async/await and futures management
  • Practice error design in a Rust library, using thiserror
  • Practice HTTP mocking using mockito, tests and documentation in Rust.

About

Rust "Astronomy Picture Of the Day" client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages