Skip to content

Commit

Permalink
corrected temperature.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
benzlokzik committed Nov 3, 2023
1 parent 8a5ab54 commit 1ae80d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/handlers/temperature.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use actix_web::{web, HttpResponse, Responder};
use crate::models::temperature_conversion::{Celsius, Fahrenheit};

pub async fn celsius_to_fahrenheit(web::Path(temp): web::Path<f64>) -> impl Responder {
pub async fn celsius_to_fahrenheit(temp: web::Path<f64>) -> impl Responder {
let temp = temp.into_inner();
let fahrenheit = Celsius::new(temp).to_fahrenheit();
HttpResponse::Ok().json(fahrenheit)
}

pub async fn fahrenheit_to_celsius(web::Path(temp): web::Path<f64>) -> impl Responder {
pub async fn fahrenheit_to_celsius(temp: web::Path<f64>) -> impl Responder {
let temp = temp.into_inner();
let celsius = Fahrenheit::new(temp).to_celsius();
HttpResponse::Ok().json(celsius)
}

0 comments on commit 1ae80d0

Please sign in to comment.