#[cfg(feature = "compile-time-config")]
mod compile_time_blob {
include!(concat!(env!("OUT_DIR"), "/compile_time_config.rs"));
}
#[cfg(feature = "compile-time-config")]
impl super::types::Config {
pub fn compile_time() -> Result<super::types::Config, super::types::ConfigError> {
let cfg = compile_time_blob::build_compile_time_config();
cfg.validate_runtime()
}
}
#[cfg(feature = "compile-time-config")]
impl super::types::Config {
pub(crate) fn validate_runtime(
self,
) -> Result<super::types::Config, super::types::ConfigError> {
if self.clock_source.clk_id().is_none() {
return Err(super::types::ConfigError::ClockSourceUnsupported {
source: self.clock_source,
platform: std::env::consts::OS,
});
}
Ok(self)
}
}