pub struct CommitRef<'a> { /* private fields */ }Expand description
Parsed commit headers and message body borrowing from the object bytes.
Implementations§
Source§impl<'a> CommitRef<'a>
impl<'a> CommitRef<'a>
Sourcepub fn parse(data: &'a [u8]) -> Result<Self>
pub fn parse(data: &'a [u8]) -> Result<Self>
Parse a commit object without allocating author, committer, or message strings.
§Errors
Returns Error::CorruptObject when required headers are missing or malformed.
A header block that ends at EOF (no blank line before the message) is accepted with an empty message, matching Git’s commit parser.
Raw author header payload (after author ), with continuation lines merged.
Sourcepub fn committer_raw(&self) -> &[u8] ⓘ
pub fn committer_raw(&self) -> &[u8] ⓘ
Raw committer header payload (after committer ), with continuation lines merged.
Sourcepub fn encoding_raw(&self) -> Option<&[u8]>
pub fn encoding_raw(&self) -> Option<&[u8]>
Optional encoding header value bytes when present and UTF-8.
Sourcepub fn extra_headers(&self) -> Cow<'_, [u8]>
pub fn extra_headers(&self) -> Cow<'_, [u8]>
Extra header bytes (gpgsig, mergetag, change-id, …) excluding tree/parent/author/committer/encoding.
Sourcepub fn message_bytes(&self) -> &[u8] ⓘ
pub fn message_bytes(&self) -> &[u8] ⓘ
Commit message body bytes (everything after the blank line).
Decoded author identity line (uses Self::encoding_raw when set).
Sourcepub fn committer(&self) -> String
pub fn committer(&self) -> String
Decoded committer identity line (uses Self::encoding_raw when set).
Sourcepub fn message(&self) -> Cow<'_, str>
pub fn message(&self) -> Cow<'_, str>
Decoded commit message (uses Self::encoding_raw when set).
Sourcepub fn committer_timestamp(&self) -> i64
pub fn committer_timestamp(&self) -> i64
Committer unix seconds for --until / --since filtering (unknown → 0).
Sourcepub fn committer_unix_seconds_for_ordering(&self) -> i64
pub fn committer_unix_seconds_for_ordering(&self) -> i64
Committer unix seconds for rev-list date ordering (unknown → 0).
Author unix seconds for rev-list author-date ordering (unknown → 0).
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Re-serialize using the original header block (byte-identical when the source object was valid).
Sourcepub fn to_owned(&self) -> CommitData
pub fn to_owned(&self) -> CommitData
Build an owning CommitData matching super::parse_commit output.
Trait Implementations§
impl<'a> Eq for CommitRef<'a>
impl<'a> StructuralPartialEq for CommitRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for CommitRef<'a>
impl<'a> RefUnwindSafe for CommitRef<'a>
impl<'a> Send for CommitRef<'a>
impl<'a> Sync for CommitRef<'a>
impl<'a> Unpin for CommitRef<'a>
impl<'a> UnsafeUnpin for CommitRef<'a>
impl<'a> UnwindSafe for CommitRef<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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
key and return true if they are equal.