1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! End-to-end typesafe RPC between Rust lambdas on Vercel and any TypeScript frontend.
//!
//! This crate is a facade that re-exports the [`metaxy-macro`] proc macros together
//! with all runtime dependencies they need. Users only have to add two dependencies:
//!
//! ```toml
//! [dependencies]
//! metaxy = "0.1"
//! serde = { version = "1", features = ["derive"] }
//! ```
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use metaxy::rpc_query;
//!
//! #[rpc_query]
//! async fn hello(name: String) -> String {
//! format!("Hello, {}!", name)
//! }
//! ```
pub use ;
pub use ;
/// HTTP header map for accessing request headers in RPC handlers.
///
/// Add a `Headers` parameter to your handler function to receive
/// the incoming request headers:
///
/// ```rust,ignore
/// use metaxy::{rpc_query, Headers};
///
/// #[rpc_query]
/// async fn secret(headers: Headers) -> Result<String, String> {
/// let auth = headers.get("authorization")
/// .and_then(|v| v.to_str().ok());
/// if auth != Some("Bearer my-token") {
/// return Err("Unauthorized".into());
/// }
/// Ok("secret data".into())
/// }
/// ```
pub type Headers = HeaderMap;
pub use ;
/// Hidden re-exports consumed by code generated by the proc macros.
/// Not part of the public API — do not depend on these directly.