mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-27 10:39:03 +02:00
lint and readme cleanup (#97)
This commit is contained in:
@ -2,15 +2,16 @@
|
||||
name = "prost-example"
|
||||
version = "0.5.1"
|
||||
edition = "2018"
|
||||
authors = ["kingxsp <jin.hb.zh@outlook.com>", "Yuki Okushi <huyuumi.dev@gmail.com>"]
|
||||
authors = [
|
||||
"kingxsp <jin.hb.zh@outlook.com>",
|
||||
"Yuki Okushi <huyuumi.dev@gmail.com>"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
actix-web = "3.0.0"
|
||||
actix-rt = "1"
|
||||
actix-protobuf = { path = "../../" }
|
||||
|
||||
bytes = "0.5"
|
||||
env_logger = "*"
|
||||
|
||||
env_logger = "0.7"
|
||||
prost = "0.6.0"
|
||||
prost-derive = "0.6.0"
|
||||
|
@ -1,13 +1,12 @@
|
||||
#[macro_use]
|
||||
extern crate prost_derive;
|
||||
|
||||
use actix_protobuf::*;
|
||||
use actix_web::*;
|
||||
use prost_derive::Message;
|
||||
|
||||
#[derive(Clone, PartialEq, Message)]
|
||||
pub struct MyObj {
|
||||
#[prost(int32, tag = "1")]
|
||||
pub number: i32,
|
||||
|
||||
#[prost(string, tag = "2")]
|
||||
pub name: String,
|
||||
}
|
||||
@ -17,7 +16,7 @@ async fn index(msg: ProtoBuf<MyObj>) -> Result<HttpResponse> {
|
||||
HttpResponse::Ok().protobuf(msg.0) // <- send response
|
||||
}
|
||||
|
||||
#[actix_rt::main]
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_web=debug,actix_server=info");
|
||||
env_logger::init();
|
||||
|
Reference in New Issue
Block a user