pub enum Branch {
Local {
name: String,
committer_email: String,
committer_date_time: Timestamp,
},
Remote {
name: String,
committer_email: String,
committer_date_time: Timestamp,
},
}Expand description
Local or remote branch with metadata about the last commit.
Variants§
Local
Local branch (under refs/heads/).
Fields
§
committer_date_time: TimestampThe date and time when the last commit was made.
Remote
Remote tracking branch (under refs/remotes/).
Implementations§
Source§impl Branch
impl Branch
Sourcepub fn name_no_origin(&self) -> &str
pub fn name_no_origin(&self) -> &str
Returns the branch name with the “origin/” prefix removed if present.
Sourcepub fn committer_email(&self) -> &str
pub fn committer_email(&self) -> &str
Returns the email address of the last committer on this branch.
Sourcepub const fn committer_date_time(&self) -> &Timestamp
pub const fn committer_date_time(&self) -> &Timestamp
Returns the timestamp of the last commit on this branch.
Trait Implementations§
Source§impl<'a> TryFrom<(Branch<'a>, BranchType)> for Branch
Attempts to convert a libgit2 branch and its type into our Branch enum.
impl<'a> TryFrom<(Branch<'a>, BranchType)> for Branch
Attempts to convert a libgit2 branch and its type into our Branch enum.
Extracts the branch name, last committer email and date from the raw branch.
§Errors
- Branch name is not valid UTF-8.
- Resolving the branch tip commit fails.
- Committer email is not valid UTF-8.
- Converting the committer timestamp into a [
Timestamp] fails.
Auto Trait Implementations§
impl Freeze for Branch
impl RefUnwindSafe for Branch
impl Send for Branch
impl Sync for Branch
impl Unpin for Branch
impl UnsafeUnpin for Branch
impl UnwindSafe for Branch
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