retrofit_rs/
lib.rs

1//! # Retrofit-rs
2//!
3//! A type-safe, declarative HTTP client library for Rust, inspired by Java Retrofit.
4//!
5//! ## Features
6//!
7//! - 🎯 Declarative API with procedural macros
8//! - 🔒 Type-safe at compile time
9//! - ⚡ Async/await support
10//! - 🔄 Powerful interceptor system
11//! - 📝 Automatic serialization/deserialization
12//!
13//! ## Quick Start
14//!
15//! ```rust,no_run
16//! use retrofit_rs::{api, get, Result};
17//! use serde::Deserialize;
18//!
19//! #[derive(Deserialize)]
20//! struct User {
21//!     name: String,
22//! }
23//!
24//! #[api("https://api.example.com")]
25//! trait MyApi {
26//!     #[get("/users/{id}")]
27//!     async fn get_user(&self, id: u64) -> Result<User>;
28//! }
29//!
30//! #[tokio::main]
31//! async fn main() -> Result<()> {
32//!     let api = MyApiClient::new()?;
33//!     let user = api.get_user(1).await?;
34//!     println!("{}", user.name);
35//!     Ok(())
36//! }
37//! ```
38
39mod client;
40mod error;
41pub mod interceptor;
42pub mod interceptors;
43mod request;
44pub mod types;
45
46pub use client::{Retrofit, RetrofitBuilder};
47pub use error::{Result, RetrofitError};
48pub use interceptor::{Chain, Interceptor, Request, Response};
49pub use request::RequestBuilder;
50pub use types::{Body, Header, Path, Query};
51
52// Re-export macros
53pub use retrofit_rs_macros::*;
54
55// Re-export async_trait for macro usage
56pub use async_trait::async_trait;