Skip to content

Commit

Permalink
feat: impl From<String> for ChangeType
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanty committed Mar 24, 2024
1 parent 718c4aa commit dd81675
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ impl From<&str> for ChangeType {
}
}

impl From<String> for ChangeType {
fn from(s: String) -> Self {
match s.as_str() {
"patch" => ChangeType::Patch,
"minor" => ChangeType::Minor,
"major" => ChangeType::Major,
_ => ChangeType::Custom(s),
}
}
}

impl Ord for ChangeType {
fn cmp(&self, other: &Self) -> Ordering {
match (self, other) {
Expand Down

0 comments on commit dd81675

Please sign in to comment.