hackathon_question1 0.1.0

A hackathon task.
Documentation
extern crate reqwest;
use std::collections::HashMap;
extern crate serde;






pub mod weather{

pub fn textresponse() -> Result<(), Box<dyn std::error::Error>> {

    
    let resp = reqwest::blocking::get("http://api.weatherapi.com/v1/current.json?key=3f3fc68039bb425d9bf213209200407&q=karachi
    ")?
        .text()?;
    println!("{:#?}", resp);
    Ok(())
}

// struct location{
// name: String,
// region: String,
// country: String,
// lat: u32,
// lon: u32,
// tz_id: String,
// localtime_epoch: u32,
// localtime: String,
// }

// struct current{
//     temp_c: u8,
    
// }
// #[derive(Deserialize)]
// struct data{
//     location:location,
//     current:current,
// }



pub fn jsonresponse() -> Result<(), Box<dyn std::error::Error>> {
    let resp = reqwest::blocking::get("http://api.weatherapi.com/v1/current.json?key=3f3fc68039bb425d9bf213209200407&q=karachi
    ")?
    .json()?;
    
    Ok(())
}

}