#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub struct BundledAssetMetadata {
pub path: &'static str,
pub schema: &'static str,
pub sha256: &'static str,
pub source: &'static str,
pub license: &'static str,
pub generator: &'static str,
pub generation_command: &'static str,
pub validation_report: &'static str,
pub calibration_status: &'static str,
}
include!(concat!(env!("OUT_DIR"), "/nsb_bundled_assets.rs"));
pub fn bundled_asset(path: &str) -> Option<&'static BundledAssetMetadata> {
BUNDLED_ASSETS.iter().find(|asset| asset.path == path)
}
pub fn bundled_assets() -> impl Iterator<Item = &'static BundledAssetMetadata> {
BUNDLED_ASSETS.iter()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn verified_bundled_assets_are_versioned_and_unique() {
assert_eq!(ASSET_MANIFEST_SCHEMA_VERSION, 1);
let mut paths: Vec<&str> = BUNDLED_ASSETS.iter().map(|asset| asset.path).collect();
let before = paths.len();
paths.sort_unstable();
paths.dedup();
assert_eq!(paths.len(), before);
assert!(bundled_assets().count() >= 5);
assert!(bundled_asset("airglow_palace_v1.dat").is_some());
assert!(bundled_asset("f107_store.json").is_some());
assert!(bundled_asset("starlight_nside128.csv").is_none());
assert!(bundled_asset("merge_report.json").is_none());
}
}