Created
January 10, 2025 19:00
-
-
Save kennykerr/d50c8467df9aa20c666bb617dfb7d6c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use super::*; | |
#[doc(hidden)] | |
pub fn index() { | |
let reader = Reader::new(expand_input(&["default"])); | |
for types in reader.values() { | |
for ty in types.values().flatten() { | |
let tn = ty.type_name(); | |
let mut dependencies = TypeMap::new(); | |
ty.dependencies(&mut dependencies); | |
let features: BTreeSet<&'static str> = | |
dependencies.keys().map(|tn| tn.namespace()).collect(); | |
let mut compact = BTreeSet::<&'static str>::new(); | |
for feature in features.iter().rev() { | |
let mut keep = true; | |
for compact in &compact { | |
if namespace_starts_with(compact, feature) { | |
keep = false; | |
break; | |
} | |
} | |
if keep { | |
compact.insert(feature); | |
} | |
} | |
let mut features = BTreeSet::new(); | |
for dependency in compact { | |
if dependency.is_empty() | |
|| dependency == "Windows.Foundation" | |
|| dependency == "Windows.Win32.Foundation" | |
{ | |
continue; | |
} | |
let mut feature = String::new(); | |
for name in dependency.split('.').skip(1) { | |
feature.push_str(name); | |
feature.push('_'); | |
} | |
feature.truncate(feature.len() - 1); | |
features.insert(feature); | |
} | |
println!("\n{}", tn.name()); | |
for feature in features { | |
println!(" {feature}"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment