hackathon_question1/
lib.rs1extern crate reqwest;
2use std::collections::HashMap;
3extern crate serde;
4
5
6
7
8
9
10pub mod weather{
11
12pub fn textresponse() -> Result<(), Box<dyn std::error::Error>> {
13
14
15 let resp = reqwest::blocking::get("http://api.weatherapi.com/v1/current.json?key=3f3fc68039bb425d9bf213209200407&q=karachi
16 ")?
17 .text()?;
18 println!("{:#?}", resp);
19 Ok(())
20}
21
22pub fn jsonresponse() -> Result<(), Box<dyn std::error::Error>> {
46 let resp = reqwest::blocking::get("http://api.weatherapi.com/v1/current.json?key=3f3fc68039bb425d9bf213209200407&q=karachi
47 ")?
48 .json()?;
49
50 Ok(())
51}
52
53}
54
55
56