pub struct Commit { /* private fields */ }Implementations§
Source§impl Commit
impl Commit
pub fn new( id: &str, author: &str, timestamp: DateTime<FixedOffset>, message: &str, ) -> Self
Sourcepub fn new_from_str(
id: &str,
author: &str,
timestamp: &str,
message: &str,
) -> Result<Self, Alert>
pub fn new_from_str( id: &str, author: &str, timestamp: &str, message: &str, ) -> Result<Self, Alert>
Creates a new Commit object after converting string for timestamp to a DateTime.
Sourcepub fn new_from_commit(commit: String) -> Result<Self, Alert>
pub fn new_from_commit(commit: String) -> Result<Self, Alert>
Creates a new Commit object from a standard commit in text format from “git log” output.
§Example:
use semver_common::Commit;
use chrono::DateTime;
let c = String::from(
"490049bf36b19b30d23b4be5a4u94f71b5c6475c
Author: Some Author <myemail@email.com>
Date: Tue Apr 14 17:35:15 2026 -0400
feat: added feature to get commit list
",
);
let commit =
Commit::new_from_commit(c).expect("Commit could not be instantiated during test.");
assert_eq!(commit.id(), "490049bf36b19b30d23b4be5a4u94f71b5c6475c");
assert_eq!(commit.author(), "Some Author <myemail@email.com>");
assert_eq!(
commit.timestamp(),
&DateTime::parse_from_str("Tue Apr 14 17:35:15 2026 -0400", "%a %b %d %H:%M:%S %Y %z").unwrap()
);
assert_eq!(commit.message(), "feat: added feature to get commit list");Trait Implementations§
Source§impl<'de> Deserialize<'de> for Commit
impl<'de> Deserialize<'de> for Commit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Commit
impl Ord for Commit
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Commit
impl PartialOrd for Commit
impl Eq for Commit
Auto Trait Implementations§
impl Freeze for Commit
impl RefUnwindSafe for Commit
impl Send for Commit
impl Sync for Commit
impl Unpin for Commit
impl UnsafeUnpin for Commit
impl UnwindSafe for Commit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.