1pub enum Commit {
2 NeedsPrefixing(String),
3 Prefixed(String),
4}
5
6impl Commit {
7 pub fn new(content: String) -> Commit {
8 if content.starts_with("gccrs: ")
9 || content.starts_with("rust: ")
10 || content.starts_with("Rust: ")
11 {
12 Commit::Prefixed(content)
13 } else {
14 Commit::NeedsPrefixing(content)
15 }
16 }
17
18 pub fn maybe_prefix(self) -> String {
19 match self {
20 Commit::NeedsPrefixing(content) => format!("gccrs: {content}"),
21 Commit::Prefixed(content) => content,
22 }
23 }
24}