Struct git_object::commit::ExtraHeaders
source · pub struct ExtraHeaders<I> { /* private fields */ }
Implementations§
source§impl<'a, I> ExtraHeaders<I>where
I: Iterator<Item = (&'a BStr, &'a BStr)>,
impl<'a, I> ExtraHeaders<I>where
I: Iterator<Item = (&'a BStr, &'a BStr)>,
Instantiation and convenience.
sourcepub fn new(iter: I) -> Self
pub fn new(iter: I) -> Self
Create a new instance from an iterator over tuples of (name, value) pairs.
Examples found in repository?
src/commit/mod.rs (line 48)
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
pub fn extra_headers(&self) -> crate::commit::ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>> {
crate::commit::ExtraHeaders::new(self.extra_headers.iter().map(|(k, v)| (*k, v.as_ref())))
}
/// Return the author, with whitespace trimmed.
///
/// This is different from the `author` field which may contain whitespace.
pub fn author(&self) -> git_actor::SignatureRef<'a> {
self.author.trim()
}
/// Return the committer, with whitespace trimmed.
///
/// This is different from the `committer` field which may contain whitespace.
pub fn committer(&self) -> git_actor::SignatureRef<'a> {
self.committer.trim()
}
/// Returns a partially parsed message from which more information can be derived.
pub fn message(&self) -> MessageRef<'a> {
MessageRef::from_bytes(self.message)
}
/// Returns the time at which this commit was created.
pub fn time(&self) -> git_actor::Time {
self.committer.time
}
}
impl Commit {
/// Returns a convenient iterator over all extra headers.
pub fn extra_headers(&self) -> ExtraHeaders<impl Iterator<Item = (&BStr, &BStr)>> {
ExtraHeaders::new(self.extra_headers.iter().map(|(k, v)| (k.as_bstr(), v.as_bstr())))
}
sourcepub fn find(self, name: &str) -> Option<&'a BStr>
pub fn find(self, name: &str) -> Option<&'a BStr>
Find the value of the first header with the given name
.
sourcepub fn find_all(self, name: &'a str) -> impl Iterator<Item = &'a BStr>
pub fn find_all(self, name: &'a str) -> impl Iterator<Item = &'a BStr>
Return an iterator over all values of headers with the given name
.
Return an iterator over all git mergetags.
A merge tag is a tag object embedded within the respective header field of a commit, making it a child object of sorts.
sourcepub fn pgp_signature(self) -> Option<&'a BStr>
pub fn pgp_signature(self) -> Option<&'a BStr>
Return the cryptographic signature provided by gpg/pgp verbatim.