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,4 +1,4 @@
use actix_web::{web, App, HttpResponse, HttpServer};
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
@ -20,9 +20,9 @@ fn store_event_in_db(timestamp: f64, kind: String, tags: Vec<String>) -> Event {
}
}
fn capture_event(evt: web::Json<Event>) -> actix_web::Result<HttpResponse> {
fn capture_event(evt: web::Json<Event>) -> impl Responder {
let new_event = store_event_in_db(evt.timestamp, evt.kind.clone(), evt.tags.clone());
Ok(HttpResponse::Ok().json(new_event))
format!("got event {}", new_event.id.unwrap())
}
fn index() -> HttpResponse {