prt_core/lib.rs
1//! # prt-core
2//!
3//! Core library for **prt** — a real-time network port monitor.
4//!
5//! This crate provides the platform-independent logic for scanning, tracking,
6//! filtering, sorting, and exporting network port information. It is designed
7//! to be consumed by any frontend (TUI, GUI, CLI).
8//!
9//! # Architecture
10//!
11//! ```text
12//! platform::scan_ports()
13//! → Session::refresh()
14//! → scanner::diff_entries() (New / Unchanged / Gone)
15//! → scanner::sort_entries()
16//! → scanner::filter_indices()
17//! → UI renders
18//! ```
19//!
20//! # Modules
21//!
22//! - [`model`] — Core data types: [`PortEntry`](model::PortEntry),
23//! [`TrackedEntry`](model::TrackedEntry), [`SortState`](model::SortState), enums.
24//! - [`core`] — Business logic: scanning, diffing, filtering, sorting, killing,
25//! session management.
26//! - [`i18n`] — Internationalization: runtime-switchable language support
27//! (English, Russian, Chinese) backed by `AtomicU8`.
28//! - [`platform`] — OS-specific port scanning: macOS (`lsof`), Linux (`/proc`).
29//!
30//! # Example
31//!
32//! ```no_run
33//! use prt_core::core::scanner;
34//! use prt_core::model::ExportFormat;
35//!
36//! let entries = scanner::scan().expect("scan failed");
37//! let json = scanner::export(&entries, ExportFormat::Json).unwrap();
38//! println!("{json}");
39//! ```
40
41pub mod core;
42pub mod i18n;
43pub mod model;
44pub mod platform;