1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum VersionBinding { LessThan, GreaterThan, LessThanOrEqual, GreaterThanOrEqual, Equal, Any, Unknown, } impl VersionBinding { pub fn from_str(s: &str) -> Self { let s = s.split(' ').collect::<Vec<&str>>()[0]; match s { ">" => VersionBinding::GreaterThan, "<" => VersionBinding::LessThan, ">=" => VersionBinding::GreaterThanOrEqual, "<=" => VersionBinding::LessThanOrEqual, "=" => VersionBinding::Equal, _ => VersionBinding::Unknown, } } }