metaxy 0.1.3

End-to-end typesafe RPC between Rust and TypeScript
Documentation
#![warn(missing_docs)]
//! 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 metaxy_macro::{rpc_mutation, rpc_query};

pub use serde::{Deserialize, Serialize};

/// 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 = http::HeaderMap;

/// Hidden re-exports consumed by code generated by the proc macros.
/// Not part of the public API — do not depend on these directly.
#[doc(hidden)]
pub mod __private {
    pub use http_body_util;
    pub use serde_json;
    pub use tokio;
    pub use url;
    pub use vercel_runtime;
}