#[derive(Debug, Clone, Copy, Default)]
pub struct MapOptions {
pub hash_reuse: bool,
pub no_semantic: bool,
}
impl MapOptions {
pub fn from_env() -> Self {
MapOptions {
hash_reuse: std::env::var("SCOUT_MTIME_REUSE").as_deref() != Ok("1"),
no_semantic: false,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_keeps_semantic_enrichment_on() {
assert!(!MapOptions::default().no_semantic);
assert!(!MapOptions::from_env().no_semantic);
}
#[test]
fn no_semantic_is_independently_settable() {
let opts = MapOptions {
hash_reuse: true,
no_semantic: true,
};
assert!(opts.hash_reuse);
assert!(opts.no_semantic);
}
}