summaryrefslogtreecommitdiffstats
path: root/src/watch
diff options
context:
space:
mode:
Diffstat (limited to 'src/watch')
-rw-r--r--src/watch/staleness.rs33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/watch/staleness.rs b/src/watch/staleness.rs
index 4e171a1..94813eb 100644
--- a/src/watch/staleness.rs
+++ b/src/watch/staleness.rs
@@ -7,15 +7,34 @@ pub enum Kind {
Missing,
}
-#[derive(Debug, Clone)]
-pub struct Stale {
- pub kind: Kind,
- pub pkgbase: String,
- pub dependency: String,
- pub built_with: String,
- pub now: String,
+/// The real definition. The module is private, so this `pub`
+/// is not a nameable path from outside; the alias below is the
+/// only way to reach it, and the alias is what carries the
+/// feature-conditional visibility.
+mod stale {
+ use super::*;
+
+ #[derive(Debug, Clone)]
+ pub struct Stale {
+ pub kind: Kind,
+ pub pkgbase: String,
+ pub dependency: String,
+ pub built_with: String,
+ pub now: String,
+ }
}
+/// one row of the staleness report. `http` and `ops` read the report `stale_rows` returns, but only the staleness tests write the name.
+///
+/// `pub` only under `test-support`. Production reaches the type
+/// through its own module and never names it from outside; the
+/// outside reader that needs the name is a test.
+#[cfg(feature = "test-support")]
+pub use stale::Stale;
+
+#[cfg(not(feature = "test-support"))]
+pub(crate) use stale::Stale;
+
pub fn stale_rows(db: &Db) -> Result<Vec<Stale>> {
let rows = db::published_world_members(db)?;