MCPcopy Create free account
hub / github.com/csskit/csskit / collect_properties_from_versions

Function collect_properties_from_versions

crates/csskit_spec_generator/src/main.rs:105–133  ·  view source on GitHub ↗

Collects and merges properties from all versions of a spec Returns the unique properties and the latest version number

(
	client: &reqwest::Client,
	name: &str,
	versions: &[usize],
)

Source from the content-addressed store, hash-verified

103///
104/// Returns the unique properties and the latest version number
105async fn collect_properties_from_versions(
106 client: &reqwest::Client,
107 name: &str,
108 versions: &[usize],
109) -> Result<(Vec<PropertyDefinition>, usize)> {
110 let mut all_properties: HashMap<String, PropertyDefinition> = HashMap::new();
111 let mut latest_version = 0;
112
113 for &version in versions {
114 println!(" Processing {}-{}/...", name, version);
115 latest_version = version;
116
117 match process_single_version(client, name, version, &mut all_properties).await {
118 Ok(count) => {
119 if count == 0 {
120 println!(" No properties found");
121 } else {
122 println!(" Found {} properties", count);
123 }
124 }
125 Err(e) => {
126 eprintln!(" Error processing version: {}", e);
127 }
128 }
129 }
130
131 let properties: Vec<PropertyDefinition> = all_properties.into_values().collect();
132 Ok((properties, latest_version))
133}
134
135/// Processes a single spec version and adds its properties to the accumulator
136///

Callers 2

generate_single_specFunction · 0.85
mainFunction · 0.85

Calls 2

process_single_versionFunction · 0.85
collectMethod · 0.80

Tested by

no test coverage detected