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// Re-export commonly used types
103pub use error::{ArchToolkitError as Error, Result};
104pub use types::{AurComment, AurPackage, AurPackageDetails};
105
106#[cfg(feature = "aur")]
107pub use client::{ArchClient, ArchClientBuilder, CacheInvalidator};
108
109#[cfg(feature = "aur")]
110pub use cache::{CacheConfig, CacheConfigBuilder};