claude_codes/client/
mod.rs

1//! High-level client implementations for interacting with Claude.
2//!
3//! This module provides two client types for different use cases:
4//!
5//! - [`AsyncClient`] - Asynchronous client using Tokio (recommended for most applications)
6//! - [`SyncClient`] - Synchronous client using standard library threads
7//!
8//! Both clients handle:
9//! - Process lifecycle management
10//! - Message serialization/deserialization
11//! - Response streaming
12//! - Error handling
13//! - Automatic version compatibility checking
14//!
15//! # Choosing a Client
16//!
17//! Use [`AsyncClient`] when:
18//! - Building async applications with Tokio
19//! - You need concurrent operations
20//! - Working with web frameworks like Axum or Actix
21//!
22//! Use [`SyncClient`] when:
23//! - Building CLI tools without async runtime
24//! - Integrating with synchronous codebases
25//! - Simplicity is more important than performance
26//!
27//! # Example
28//!
29//! ```no_run
30//! # async fn async_example() -> Result<(), Box<dyn std::error::Error>> {
31//! use claude_codes::AsyncClient;
32//!
33//! let mut client = AsyncClient::with_defaults().await?;
34//! let responses = client.query("Hello, Claude!").await?;
35//! # Ok(())
36//! # }
37//!
38//! # fn sync_example() -> Result<(), Box<dyn std::error::Error>> {
39//! use claude_codes::{SyncClient, ClaudeInput};
40//!
41//! let mut client = SyncClient::with_defaults()?;
42//! let input = ClaudeInput::user_message("Hello!", uuid::Uuid::new_v4());
43//! let responses = client.query(input)?;
44//! # Ok(())
45//! # }
46//! ```
47
48pub mod r#async;
49pub mod sync;
50
51pub use r#async::AsyncClient;
52pub use sync::SyncClient;