mirror of
https://github.com/actix/actix-extras.git
synced 2025-01-22 23:05:56 +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
|
||||
|
||||
```rust,ignore
|
||||
use actix_web::HttpResponse;
|
||||
use actix_web::{HttpResponse, Result};
|
||||
use actix_protobuf::ProtoBuf;
|
||||
use futures::Future;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Message)]
|
||||
pub struct MyObj {
|
||||
@ -18,9 +17,9 @@ pub struct MyObj {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
fn index(msg: ProtoBuf<MyObj>) -> HttpResponse {
|
||||
fn index(msg: ProtoBuf<MyObj>) -> Result<HttpResponse> {
|
||||
println!("model: {:?}", val);
|
||||
HttpResponse::Ok().protobuf(val)?) // <- send response
|
||||
HttpResponse::Ok().protobuf(val) // <- send response
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user