libbpf-rs is a Rust workspace providing safe, idiomatic bindings to the Linux libbpf C library for eBPF program development. It consists of two main crates: `libbpf-rs`, a high-level runtime library for loading, attaching, and managing eBPF programs and maps, and `libbpf-cargo`, a Cargo plugin that compiles eBPF C source files and generates Rust skeleton code with type-safe accessors and lifecycle management. The library supports a wide range of eBPF attachment types (kprobes, tracepoints, XDP, TC, netfilter, etc.), CO-RE (Compile-Once-Run-Everywhere) via BTF, and includes utilities like ring buffer and perf buffer helpers, a query interface for inspecting loaded kernel objects, and a linker for combining multiple BPF objects. Architecture is a workspace with library crates and numerous example applications (e.g., runqslower, tcp_ca, tproxy) demonstrating real-world usage. Entry points include `ObjectBuilder`, `SkeletonBuilder` (from libbpf-cargo), and generated skeleton APIs. The project relies on `libbpf-sys` for FFI, and examples use `clap` for CLI and `plain` for safe byte conversion. It is heavily tested with integration tests requiring root privileges.
cargo-sweep is a Cargo subcommand designed to selectively clean unused build artifacts from Rust project target directories. It operates based on various criteria such as file age, installed Rust toolchains, or target directory size limits, allowing users to reduce disk usage without performing a full 'cargo clean'. The tool is implemented as a standalone Rust binary that integrates with Cargo's metadata system to locate projects and analyze their build artifacts. The architecture centers around a modular design where command-line argument parsing (using clap) feeds into a criterion-based cleaning system. Key components include a sophisticated fingerprinting module that replicates Cargo's internal mechanism for associating build artifacts with specific Rust compiler versions, a timestamp handling system for time-based cleaning, and utility functions for human-readable byte formatting. The tool recursively discovers Cargo projects, evaluates which artifacts to retain based on the selected criterion, and safely removes the rest. Despite its technical sophistication, the project carries a maintenance warning in its README indicating it is currently unmaintained and lacks a dedicated maintainer. This is reflected in outdated dependencies (particularly cargo_metadata at version 0.9 versus the latest 0.18.0) and the project's reliance on the original author for issue triage and pull request reviews. While the code demonstrates strong engineering practices and reusable components, its future viability depends on renewed community stewardship.