MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / parse_valgrind_codspeed_version

Function parse_valgrind_codspeed_version

src/executor/valgrind/setup.rs:69–88  ·  view source on GitHub ↗

Parse a valgrind version string and extract the upstream semver plus the optional CodSpeed iteration number. Accepted formats: - `valgrind-3.25.1.codspeed` (legacy, no iteration) - `valgrind-3.25.1.codspeed2` (with iteration) - same forms without the `valgrind-` prefix

(version_str: &str)

Source from the content-addressed store, hash-verified

67/// - `valgrind-3.25.1.codspeed2` (with iteration)
68/// - same forms without the `valgrind-` prefix
69fn parse_valgrind_codspeed_version(version_str: &str) -> Option<ValgrindVersion> {
70 let stripped = version_str
71 .trim()
72 .strip_prefix("valgrind-")
73 .unwrap_or(version_str.trim());
74
75 let (semver_part, iteration_part) = stripped.split_once(".codspeed")?;
76 let semver = Version::parse(semver_part).ok()?;
77
78 let codspeed_iteration = if iteration_part.is_empty() {
79 None
80 } else {
81 Some(iteration_part.parse::<u32>().ok()?)
82 };
83
84 Some(ValgrindVersion {
85 semver,
86 codspeed_iteration,
87 })
88}
89
90const TOOL_NAME: &str = "valgrind";
91

Calls 1

is_emptyMethod · 0.45