generated from benzlokzik/rust-codespace-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a5ab54
commit 1ae80d0
Showing
1 changed file
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |