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:
parent
69c73c52cd
commit
d9ba78526e
@ -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
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user