cratestack_axum/lib.rs
1//! Axum-bound runtime helpers for cratestack.
2//!
3//! The crate is organized into themed modules; see each for details:
4//!
5//! - [`codec`]: codec-bound encode/decode and the [`CodecSet`] pairing.
6//! - [`transport`]: the [`HttpTransport`] trait and the
7//! `encode_transport_*` response family.
8//! - [`headers`]: request-header helpers (ETag, traceparent, client IP).
9//! - [`query`]: URL query parsing and the filter expression grammar.
10//! - [`rpc`]: the RPC binding (`POST /rpc/{op_id}` and
11//! `POST /rpc/batch`).
12//! - [`idempotency`]: idempotency-key middleware and storage trait.
13//! - [`ratelimit`]: token-bucket rate-limit middleware and storage trait.
14//! - [`schema_fingerprint`]: warn-only client/server schema drift
15//! detection via the `x-cratestack-schema-sha` header.
16
17pub use axum;
18
19pub mod codec;
20pub mod headers;
21pub mod idempotency;
22pub mod query;
23pub mod ratelimit;
24pub mod rpc;
25pub mod schema_fingerprint;
26pub mod transport;
27
28// -----------------------------------------------------------------------------
29// Crate-root re-exports — every item the `cratestack-macros` crate references
30// from `cratestack_axum::*` must remain importable from the crate root. The
31// list below is explicit (not `pub use module::*;`) so the public surface is
32// greppable from this file.
33// -----------------------------------------------------------------------------
34
35pub use codec::{
36 CodecSet, decode_codec_request, encode_codec_response, encode_codec_result,
37 encode_codec_result_with_status, validate_codec_request_headers,
38 validate_codec_response_headers,
39};
40
41pub use transport::{
42 CBOR_SEQUENCE_CONTENT_TYPE, HttpTransport, decode_transport_request_for,
43 encode_transport_result, encode_transport_result_with_status,
44 encode_transport_result_with_status_for, encode_transport_sequence_result,
45 encode_transport_sequence_result_with_status, encode_transport_sequence_result_with_status_for,
46 validate_transport_request_headers, validate_transport_request_headers_for,
47 validate_transport_response_headers, validate_transport_response_headers_for,
48};
49
50pub use headers::{
51 enrich_context_from_headers, parse_client_ip, parse_if_match_version, parse_traceparent,
52 set_version_etag,
53};
54
55pub use query::{QueryExpr, parse_filter_expression, parse_query_pairs};