mirror of
https://github.com/Stefanuk12/axum-protobuf.git
synced 2026-08-14 20:54:41 +00:00
No description
- Rust 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
axum-protobuf
A crate bringing protocol buffers to axum via prost.
Protobuf Extractor / Response
This crate provides a Protobuf extractor and response. The usage is very similar to axum's Json. Refer to their documentation for usage, but replace Json with Protobuf.
The only difference is that T must implement prost::Message + Default.
ProtoJson Extractor
Additionally, this crate provides a ProtoJson extractor that can extract both protobuf and JSON payloads, depending upon the content-type header.
Note that this does not implement IntoResponse but you can use infer_response to convert it into a JSON or protobuf response, based upon the accept header. Otherwise, you can simply convert ProtoJson to Json or Protobuf.