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

Method parse

crates/memtrack/src/kernel.rs:34–45  ·  view source on GitHub ↗

Parse the leading ` . ` of a release string, ignoring whatever follows it (patch level, `-rc`, distro suffix).

(release: &str)

Source from the content-addressed store, hash-verified

32 /// Parse the leading `<major>.<minor>` of a release string, ignoring
33 /// whatever follows it (patch level, `-rc`, distro suffix).
34 fn parse(release: &str) -> Result<Self> {
35 let mut parts = release.trim().split(['.', '-']);
36 let major = parts
37 .next()
38 .and_then(|part| part.parse().ok())
39 .context("no major version")?;
40 let minor = parts
41 .next()
42 .and_then(|part| part.parse().ok())
43 .context("no minor version")?;
44 Ok(Self::new(major, minor))
45 }
46}
47
48impl fmt::Display for KernelVersion {

Callers

nothing calls this directly

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected