pub struct Commit {
pub tree: Hash,
pub parents: Vec<Hash>,
pub author: String,
pub timestamp: i64,
pub message: String,
pub metadata: BTreeMap<String, String>,
}Expand description
a commit object pointing to a tree with metadata
Fields§
§tree: Hashroot tree hash
parents: Vec<Hash>parent commit hashes (empty for initial, 1 for linear, 2+ for merge)
author identity
timestamp: i64unix timestamp (seconds since epoch)
message: Stringcommit message
metadata: BTreeMap<String, String>optional key-value metadata (uses BTreeMap for deterministic serialization)
Implementations§
Source§impl Commit
impl Commit
Sourcepub fn new(
tree: Hash,
parents: Vec<Hash>,
author: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn new( tree: Hash, parents: Vec<Hash>, author: impl Into<String>, message: impl Into<String>, ) -> Self
create a new commit
Sourcepub fn with_timestamp(
tree: Hash,
parents: Vec<Hash>,
author: impl Into<String>,
timestamp: i64,
message: impl Into<String>,
) -> Self
pub fn with_timestamp( tree: Hash, parents: Vec<Hash>, author: impl Into<String>, timestamp: i64, message: impl Into<String>, ) -> Self
create a new commit with explicit timestamp
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
impl Eq for Commit
impl StructuralPartialEq 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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.