swan_common/
lib.rs

1// Swan HTTP Client Library - Common Types and Utilities
2//
3// This module provides the core types, traits, and utilities used by the Swan HTTP client library.
4// It is organized into several sub-modules for better maintainability and separation of concerns.
5
6pub mod types;
7pub mod parsing;
8pub mod interceptor;
9
10// Re-export commonly used types and traits for convenience
11pub use types::{HttpMethod, ContentType, HandlerArgs, HttpClientArgs, RetryPolicy, RetryConfig, ProxyConfig, ProxyType};
12pub use parsing::{parse_handler_args, parse_http_client_args};
13pub use interceptor::{SwanInterceptor, SwanStatefulInterceptor, InterceptorCache, NoOpInterceptor, ClientStateMarker};
14
15#[cfg(test)]
16mod integration_tests {
17    use super::*;
18
19    #[test]
20    fn test_module_exports() {
21        // 测试所有公共API都能正确导入
22        let _method = HttpMethod::Get;
23        let _content_type = ContentType::Json;
24        let _noop = NoOpInterceptor::default();
25        
26        // 确保解析函数可用
27        use syn::parse::ParseStream;
28        let _parse_fn: fn(ParseStream) -> syn::Result<HandlerArgs> = parse_handler_args;
29        let _parse_client_fn: fn(ParseStream) -> syn::Result<HttpClientArgs> = parse_http_client_args;
30    }
31}