Temperature converter
examples/other/temperature-converter/Cargo.toml
[package] name = "temperature-converter" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies]
examples/other/temperature-converter/input.json
{ "input_temp": 20, "input_scale": "Centigrade", "output_scale": "Kelvin" }
examples/other/temperature-converter/src/main.rs
// // Accept the input filename as a parameter // // Read JSON file into a struct // // Convert to andother struct // // Print // enum Scale { // Centigrade, // Farenheit, // Kelvin, // } // struct TemperatureInput { // input_temperature: f32, // input_scale: Scale, // output_scale: Scale, // } // fn main() { // calc(); // } // fn calc() -> Result<String, String> { // let filename = String::from("input.json"); // let fh = std::fs::File::open(filename)?; // println!("Hello, world!"); // () // } fn main() { //fibonacci(10); } //fn fibo() { //}