Skip to main content

classify_component_pin_style

Function classify_component_pin_style 

Source
pub fn classify_component_pin_style(raw: &str) -> PinStyle
Expand description

Classifies a component: pin’s raw text by shape alone.

§Examples

use deps_gitlab_ci::component::classify_component_pin_style;
use deps_gitlab_ci::PinStyle;

assert_eq!(classify_component_pin_style(&"a".repeat(40)), PinStyle::Sha);
assert_eq!(classify_component_pin_style("~latest"), PinStyle::Latest);
assert_eq!(classify_component_pin_style("1.2"), PinStyle::Partial);
assert_eq!(classify_component_pin_style("1.0.0"), PinStyle::Tag);
assert_eq!(classify_component_pin_style("some-branch"), PinStyle::Branch);