1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 07:29:02 +02:00

Front page examples return 'impl Responder'

This commit is contained in:
Cameron Dershem
2019-06-16 23:37:14 -04:00
parent f922e8fb96
commit 3f95205696
5 changed files with 24 additions and 30 deletions

View File

@ -1,5 +1,5 @@
// <easy-form-handling>
use actix_web::{web, App, HttpResponse, HttpServer};
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use serde::Deserialize;
#[derive(Deserialize)]
@ -14,11 +14,8 @@ fn index() -> HttpResponse {
.body(include_str!("../static/form.html"))
}
fn register(params: web::Form<Register>) -> actix_web::Result<HttpResponse> {
Ok(HttpResponse::Ok().body(format!(
"Hello {} from {}!",
params.username, params.country
)))
fn register(params: web::Form<Register>) -> impl Responder {
format!("Hello {} from {}!", params.username, params.country)
}
fn main() {