Expand description
actix-multiresponse
intents to allow supporting multiple response/request data formats depending on the
Content-Type
and Accept
headers.
§Supported formats
- Json
- Protobuf
All formats can be enabled with feature flags. At least one format should be enabled to make this library useful.
§Example
use prost_derive::Message;
use serde_derive::{Deserialize, Serialize};
use actix_multiresponse::Payload;
#[derive(Deserialize, Serialize, Message, Clone)]
struct TestPayload {
#[prost(string, tag = "1")]
foo: String,
#[prost(int64, tag = "2")]
bar: i64,
}
async fn responder(payload: Payload<TestPayload>) -> Payload<TestPayload> {
payload
}
Structs§
- Payload
- Payload wrapper which facilitates tje (de)serialization. This type can be used as both the request and response payload type.