MCPcopy Create free account
hub / github.com/evilsocket/cake / layers_to_range

Function layers_to_range

cake-mobile/src/lib.rs:213–224  ·  view source on GitHub ↗
(layers: &[String])

Source from the content-addressed store, hash-verified

211// ---------------------------------------------------------------------------
212
213fn layers_to_range(layers: &[String]) -> String {
214 if layers.is_empty() {
215 return "none".to_string();
216 }
217 let first_num = layers.first().and_then(|l| l.rsplit('.').next()).and_then(|n| n.parse::<usize>().ok());
218 let last_num = layers.last().and_then(|l| l.rsplit('.').next()).and_then(|n| n.parse::<usize>().ok());
219 match (first_num, last_num) {
220 (Some(f), Some(l)) if f == l => format!("layer {}", f),
221 (Some(f), Some(l)) => format!("layers {}–{} ({} total)", f, l, layers.len()),
222 _ => format!("{} layer(s)", layers.len()),
223 }
224}
225
226// ---------------------------------------------------------------------------
227// Public entry point

Callers 1

run_zero_config_workerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected