actix-protobuf

Crates.ioactix-protobuf
lib.rsactix-protobuf
version0.11.0
sourcesrc
created_at2018-03-21 23:01:40.404935
updated_at2024-07-20 06:12:37.158107
descriptionProtobuf payload extractor for Actix Web
homepagehttps://actix.rs
repositoryhttps://github.com/actix/actix-extras
max_upload_size
id56810
size28,405
Core (github:actix:core)

documentation

README

actix-protobuf

Protobuf payload extractor for Actix Web.

crates.io Documentation Apache 2.0 or MIT licensed Dependency Status

Documentation & Resources

Example

use actix_protobuf::*;
use actix_web::*;

#[derive(Clone, PartialEq, Message)]
pub struct MyObj {
    #[prost(int32, tag = "1")]
    pub number: i32,

    #[prost(string, tag = "2")]
    pub name: String,
}

async fn index(msg: ProtoBuf<MyObj>) -> Result<HttpResponse> {
    println!("model: {:?}", msg);
    HttpResponse::Ok().protobuf(msg.0) // <- send response
}

See here for the complete example.

License

This project is licensed under either of

at your option.

Commit count: 3820

cargo fmt