1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-02-02 10:59:03 +01:00

update readme example

This commit is contained in:
Nikolay Kim 2018-04-10 12:41:26 -07:00
parent 69c73c52cd
commit d9ba78526e

View File

@ -6,9 +6,8 @@ Protobuf support for actix-web framework.
## Example ## Example
```rust,ignore ```rust,ignore
use actix_web::HttpResponse; use actix_web::{HttpResponse, Result};
use actix_protobuf::ProtoBuf; use actix_protobuf::ProtoBuf;
use futures::Future;
#[derive(Clone, Debug, PartialEq, Message)] #[derive(Clone, Debug, PartialEq, Message)]
pub struct MyObj { pub struct MyObj {
@ -18,9 +17,9 @@ pub struct MyObj {
pub name: String, pub name: String,
} }
fn index(msg: ProtoBuf<MyObj>) -> HttpResponse { fn index(msg: ProtoBuf<MyObj>) -> Result<HttpResponse> {
println!("model: {:?}", val); println!("model: {:?}", val);
HttpResponse::Ok().protobuf(val)?) // <- send response HttpResponse::Ok().protobuf(val) // <- send response
} }
``` ```