Hey guys, this is Amir from Bek Brace YT channel, and in this post I am guiding you how to code a weather application in CLI fashion using Rust programming language.
The code you will find it in the description below the video:
[dependencies]
reqwest = { version = "0.11", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
colored = "2.0"
Input City Details: You’ll be prompted to enter the name of the city and its country code.
The program then shoots a request to the OpenWeatherMap API, fetching weather information specific to the location you provided.
Display Information: Once the data’s in, the program neatly presents key weather stats like description, temperature, humidity, pressure, and wind speed.
To kick things off:
Clone the Repository: Grab the Rust program and have it snug on your local machine.
Install Rust: If you haven’t already, you’ll need Rust installed. Swing by Rust’s official website for a seamless setup.
Navigate and Execute: Fire up your terminal, steer to the cloned directory, and fire up the program with a simple cargo run.
With the program up and running, just follow the prompts to punch in your city details. Voila! Your weather info pops up pronto. Feel like checking another city? Easy-peasy—just type ‘yes’ when prompted.
Before you dive headfirst, make sure you snag an API key from OpenWeatherMap. Toss that placeholder in the code and replace it with your key for smooth sailing and seamless weather data access.
And there you have it! With our Rust program, snagging weather info’s a breeze—practical, no-fuss, straight to the point. Weather updates at your fingertips, anytime, anywhere.