Skip to main content

cargo_aprz_lib/
lib.rs

1#![doc(hidden)]
2#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
3
4//! This is an implementation detail of the cargo-aprz tool. Do not take a dependency on this crate
5//! as it may change in incompatible ways without warning.
6
7// Core library for cargo-aprz
8//
9// This library consolidates all functionality for the cargo-aprz tool, which analyzes
10// Rust crates for compliance with user-defined policies.
11//
12// # Module Organization
13//
14// - [`commands`]: Command-line interface and orchestration
15// - [`facts`]: Data collection and aggregation
16// - [`metrics`]: Metric extraction from facts
17// - [`expr`]: Expression-based evaluation
18// - [`reports`]: Report generation in multiple formats
19
20pub type Result<T, E = ohno::AppError> = core::result::Result<T, E>;
21pub(crate) type HashMap<K, V> = rustc_hash::FxHashMap<K, V>;
22pub(crate) type HashSet<V> = rustc_hash::FxHashSet<V>;
23
24pub(crate) fn hash_map_with_capacity<K, V>(capacity: usize) -> HashMap<K, V> {
25    HashMap::with_capacity_and_hasher(capacity, rustc_hash::FxBuildHasher)
26}
27
28pub(crate) fn hash_set_with_capacity<V>(capacity: usize) -> HashSet<V> {
29    HashSet::with_capacity_and_hasher(capacity, rustc_hash::FxBuildHasher)
30}
31
32macro_rules! declare_modules {
33    ($($mod:ident),+ $(,)?) => {
34        $(
35            #[cfg(debug_assertions)]
36            pub mod $mod;
37            #[cfg(not(debug_assertions))]
38            mod $mod;
39        )+
40    };
41}
42
43declare_modules!(commands, expr, facts, metrics, reports);
44
45pub use crate::commands::{Host, run};