arch_toolkit/
lib.rs

1//! Complete Rust toolkit for Arch Linux package management.
2//!
3//! This crate provides a unified API for interacting with Arch Linux package management,
4//! including AUR (Arch User Repository) operations, dependency resolution, package
5//! index queries, installation command building, news feeds, and security advisories.
6//!
7//! # Features
8//!
9//! - `aur`: AUR search, package info, comments, and PKGBUILD fetching
10//! - `deps`: Dependency resolution and SRCINFO parsing (planned)
11//! - `index`: Package database queries (planned)
12//! - `install`: Installation command building (planned)
13//! - `news`: News feeds and security advisories (planned)
14//! - `sandbox`: PKGBUILD security analysis (planned)
15//!
16//! # Examples
17//!
18//! ## Basic AUR Search
19//!
20//! ```no_run
21//! use arch_toolkit::ArchClient;
22//!
23//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
24//! let client = ArchClient::new()?;
25//! let packages = client.aur().search("yay").await?;
26//! println!("Found {} packages", packages.len());
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! ## Fetch Package Details
32//!
33//! ```no_run
34//! use arch_toolkit::ArchClient;
35//!
36//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
37//! let client = ArchClient::new()?;
38//! let details = client.aur().info(&["yay", "paru"]).await?;
39//! for pkg in details {
40//!     println!("{}: {}", pkg.name, pkg.description);
41//! }
42//! # Ok(())
43//! # }
44//! ```
45//!
46//! ## Custom Configuration
47//!
48//! ```no_run
49//! use arch_toolkit::ArchClient;
50//! use std::time::Duration;
51//!
52//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
53//! let client = ArchClient::builder()
54//!     .timeout(Duration::from_secs(60))
55//!     .user_agent("my-app/1.0")
56//!     .build()?;
57//! let packages = client.aur().search("yay").await?;
58//! # Ok(())
59//! # }
60//! ```
61//!
62//! ## Fetch Comments
63//!
64//! ```no_run
65//! use arch_toolkit::ArchClient;
66//!
67//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
68//! let client = ArchClient::new()?;
69//! let comments = client.aur().comments("yay").await?;
70//! for comment in comments.iter().take(5) {
71//!     println!("{}: {}", comment.author, comment.content);
72//! }
73//! # Ok(())
74//! # }
75//! ```
76//!
77//! ## Fetch PKGBUILD
78//!
79//! ```no_run
80//! use arch_toolkit::ArchClient;
81//!
82//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
83//! let client = ArchClient::new()?;
84//! let pkgbuild = client.aur().pkgbuild("yay").await?;
85//! println!("PKGBUILD:\n{}", pkgbuild);
86//! # Ok(())
87//! # }
88//! ```
89
90pub mod error;
91pub mod types;
92
93#[cfg(feature = "aur")]
94pub mod aur;
95
96#[cfg(feature = "aur")]
97pub mod client;
98
99#[cfg(feature = "aur")]
100pub mod cache;
101
102#[cfg(feature = "aur")]
103pub mod health;
104
105#[cfg(feature = "aur")]
106mod env;
107
108/// Prelude module for convenient imports.
109///
110/// This module re-exports commonly used types, traits, and functions,
111/// allowing you to import everything you need with a single `use arch_toolkit::prelude::*;`.
112///
113/// # Example
114///
115/// ```no_run
116/// use arch_toolkit::prelude::*;
117///
118/// # async fn example() -> Result<()> {
119/// let client = ArchClient::new()?;
120/// let packages: Vec<AurPackage> = client.aur().search("yay").await?;
121/// Ok(())
122/// # }
123/// ```
124pub mod prelude;
125
126// Re-export commonly used types
127pub use error::{ArchToolkitError as Error, Result};
128pub use types::{AurComment, AurPackage, AurPackageDetails};
129
130#[cfg(feature = "aur")]
131pub use types::{HealthStatus, ServiceStatus};
132
133#[cfg(feature = "aur")]
134pub use aur::{AurApi, MockAurApi};
135
136#[cfg(feature = "aur")]
137pub use client::{ArchClient, ArchClientBuilder, CacheInvalidator, RetryPolicy};
138
139#[cfg(feature = "aur")]
140pub use cache::{CacheConfig, CacheConfigBuilder};
141
142#[cfg(feature = "aur")]
143pub use aur::validation::ValidationConfig;