1 //! This library provides Chrome feature query service. 2 3 #[cfg(feature = "chromeos")] 4 use featured::CheckFeature; 5 6 /// Queries whether the specified Chrome feature is enabled. 7 /// Returns false when the build is not for ChromeOS. 8 #[allow(unused_variables)] is_feature_enabled(name: &str) -> Result<bool, Box<dyn std::error::Error>>9pub fn is_feature_enabled(name: &str) -> Result<bool, Box<dyn std::error::Error>> { 10 cfg_if::cfg_if! { 11 if #[cfg(feature = "chromeos")] { 12 let feature = featured::Feature::new(&name, false)?; 13 14 let resp = featured::PlatformFeatures::get()? 15 .is_feature_enabled_blocking(&feature); 16 17 Ok(resp) 18 } else { 19 Ok(false) 20 } 21 } 22 } 23