Skip to main content

trash_core/
lib.rs

1//! Read-only readers for **trash / deleted-file artifacts** across operating
2//! systems. "Trash" is the umbrella term; each platform's native artifact lives
3//! in its own module:
4//!
5//! | Module | Feature | Artifact |
6//! |---|---|---|
7//! | [`windows`] | `windows` | Recycle Bin `$I`/`$R` index + content files |
8//! | [`linux`] | `linux` | freedesktop.org / XDG `info/*.trashinfo` + `files/` |
9//! | [`macos`] | `macos` | Trash `.DS_Store` put-back records (`ptbN`/`ptbL`) |
10//! | [`android`] | `android` | `MediaStore` `.trashed-`/`.pending-` filename codec |
11//! | [`ios`] | `ios` | Photos.sqlite `ZASSET` Recently-Deleted rows |
12//!
13//! Every module is gated behind a same-named Cargo feature; all are enabled by
14//! default. A consumer that only needs one platform builds with
15//! `--no-default-features --features <os>` to drop the others' dependencies.
16//!
17//! Each reader decodes its artifact into a typed record and pairs metadata with
18//! content; none produces findings — the [`trash-forensic`] analyzer layers
19//! anomaly detection on top. All readers treat their inputs as
20//! attacker-controlled: bounds-checked, never panicking on hostile data.
21//!
22//! For backward compatibility the Windows reader's items are re-exported at the
23//! crate root (`trash_core::parse_index`, [`RecycleBinIndex`], …) — that reader
24//! was this crate's original sole contents.
25//!
26//! [`trash-forensic`]: https://docs.rs/trash-forensic
27
28#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
29
30#[cfg(feature = "windows")]
31pub mod windows;
32
33#[cfg(feature = "linux")]
34pub mod linux;
35
36#[cfg(feature = "macos")]
37pub mod macos;
38
39#[cfg(feature = "android")]
40pub mod android;
41
42#[cfg(feature = "ios")]
43pub mod ios;
44
45#[cfg(feature = "windows")]
46pub use windows::{parse_index, scan_pairs, Error, IndexVersion, RecycleBinIndex, RecycleBinPair};