crabka_protocol/lib.rs
1//! Kafka wire-protocol codec.
2//!
3//! `crabka-protocol` is a pure-Rust library that encodes and decodes every
4//! Apache Kafka request and response message, byte-equivalent to the upstream
5//! JVM implementation. It performs no I/O and makes no async assumptions; it
6//! is intended to be consumed by broker, client, and tooling crates within
7//! the Crabka project.
8//!
9//! ## Two flavors
10//!
11//! Every message has two generated types:
12//!
13//! - `owned::FooRequest` — owns its data (`String`, `Bytes`, `Vec<T>`).
14//! Easy to move across `await` points.
15//! - `borrowed::FooRequest<'a>` — references slices of the input buffer
16//! (`&'a str`, `&'a [u8]`). Zero-copy decoding.
17//!
18//! Both implement [`Encode`]; the owned flavor implements [`Decode`] and the
19//! borrowed flavor implements [`DecodeBorrow`].
20//!
21//! ## Versioning
22//!
23//! `crabka-protocol` is pre-1.0. Breaking API changes per minor version are
24//! allowed; see CHANGELOG.md. The wire-protocol pin is recorded in
25//! `crates/protocol/schemas/VERSION`.
26
27pub mod api_key;
28pub use api_key::ApiKey;
29mod arbitrary_impls;
30pub mod borrowed;
31mod codec;
32#[doc(hidden)]
33pub mod codegen_helpers;
34mod error;
35pub mod kafka_3_6_2;
36pub mod legacy_compat;
37pub mod owned;
38pub mod primitives;
39pub mod records;
40pub mod tagged_fields;
41
42pub use codec::{Decode, DecodeBorrow, Encode, ProtocolRequest};
43pub use error::ProtocolError;
44pub use tagged_fields::{UnknownTaggedField, UnknownTaggedFields};