Crates.io | hackernews-types |
lib.rs | hackernews-types |
version | 0.1.2 |
source | src |
created_at | 2021-05-15 11:13:34.465391 |
updated_at | 2021-05-15 12:53:33.245917 |
description | Rust types representing items returned from the Hacker News API |
homepage | |
repository | https://github.com/orf/hncat |
max_upload_size | |
id | 397799 |
size | 4,228 |
This package contains simple types for interacting with the Hacker News API. The API documentation is not great and there are some differences. The types contained within this crate can parse every item returned from the hacker news API.
use anyhow::Result;
use reqwest;
use hackernews_types::Item;
#[tokio::main]
async fn main() -> Result<()>{
let client = reqwest::Client::new();
let resp = client.get("https://hacker-news.firebaseio.com/v0/item/8863.json").send().await?;
let item: Item = resp.json().await?;
println!("Item: {:?}", item);
Ok(())
}