pub fn extract_major_component(version: &str) -> Option<u64>Expand description
What: Extract the leading numeric component from a version string.
Inputs:
version: Version string to parse (e.g., “1.2.3”, “2.0.0-alpha”).
Output:
- Returns
Some(u64)for the first numeric segment. - Returns
Nonewhen the first segment cannot be parsed as a number.
Details:
- Splits version on
.and-, treating the first token as the major component. - Used by
is_major_version_bump()to extract major version numbers.
§Example
use arch_toolkit::deps::extract_major_component;
assert_eq!(extract_major_component("1.2.3"), Some(1));
assert_eq!(extract_major_component("2.0.0-alpha"), Some(2));
assert_eq!(extract_major_component("10.5.2"), Some(10));
assert_eq!(extract_major_component("alpha"), None);