mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
v3 examples (#364)
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
name = "protobuf-example"
|
||||
version = "0.2.0"
|
||||
authors = ["kingxsp <jin.hb.zh@outlook.com>, Yuki Okushi <huyuumi.dev@gmail.com>"]
|
||||
workspace = ".."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
@ -11,7 +10,6 @@ env_logger = "0.7.1"
|
||||
prost = "0.6.1"
|
||||
prost-derive = "0.6.1"
|
||||
|
||||
actix = "0.9.0"
|
||||
actix-protobuf = "0.5.0"
|
||||
actix-rt = "1.0.0"
|
||||
actix-web = "2.0.0"
|
||||
actix = "0.10"
|
||||
actix-protobuf = "0.6"
|
||||
actix-web = "3"
|
||||
|
@ -8,6 +8,7 @@ use actix_web::*;
|
||||
pub struct MyObj {
|
||||
#[prost(int32, tag = "1")]
|
||||
pub number: i32,
|
||||
|
||||
#[prost(string, tag = "2")]
|
||||
pub name: String,
|
||||
}
|
||||
@ -17,7 +18,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