summaryrefslogtreecommitdiffstats
path: root/src/sandbox/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sandbox/mod.rs')
-rw-r--r--src/sandbox/mod.rs27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/sandbox/mod.rs b/src/sandbox/mod.rs
index 6c90f7f..ded76f0 100644
--- a/src/sandbox/mod.rs
+++ b/src/sandbox/mod.rs
@@ -73,13 +73,30 @@ impl SandboxSpec {
}
}
-#[derive(Debug, Clone)]
-pub struct SandboxInfo {
- pub id: String,
- pub profile: String,
- pub warm: bool,
+/// 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 sandbox_info {
+ #[derive(Debug, Clone)]
+ pub struct SandboxInfo {
+ pub id: String,
+ pub profile: String,
+ pub warm: bool,
+ }
}
+/// The return type of `SandboxBackend::status`. No production module outside `sandbox` names it; the backend tests do.
+///
+/// `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 sandbox_info::SandboxInfo;
+
+#[cfg(not(feature = "test-support"))]
+pub(crate) use sandbox_info::SandboxInfo;
+
pub trait Sandbox: Send + Sync {
fn id(&self) -> &str;
fn run(&self, cmd: &Cmd, on_log: &mut dyn FnMut(&[u8])) -> Result<Exit>;