git-next/crates/git/src/commit.rs

37 lines
825 B
Rust
Raw Normal View History

2024-05-14 16:28:17 +01:00
#[derive(Clone, Debug, PartialEq, Eq, derive_more::Display)]
#[display("{}", sha)]
pub struct Commit {
sha: Sha,
message: Message,
}
impl Commit {
pub fn new(sha: &str, message: &str) -> Self {
Self {
sha: Sha::new(sha.to_string()),
message: Message::new(message.to_string()),
}
}
pub const fn sha(&self) -> &Sha {
&self.sha
}
pub const fn message(&self) -> &Message {
&self.message
}
}
2024-05-14 16:28:17 +01:00
#[derive(Clone, Debug, PartialEq, Eq, derive_more::Display)]
pub struct Sha(String);
impl Sha {
pub const fn new(value: String) -> Self {
Self(value)
}
}
2024-05-14 16:28:17 +01:00
#[derive(Clone, Debug, PartialEq, Eq, derive_more::Display)]
pub struct Message(String);
impl Message {
pub const fn new(value: String) -> Self {
Self(value)
}
}