pub enum GitReference {
Branch(String),
Tag(String),
BranchOrTag(String),
BranchOrTagOrCommit(String),
NamedRef(String),
DefaultBranch,
}Expand description
A reference to commit or commit-ish.
Variants§
Branch(String)
A specific branch.
Tag(String)
A specific tag.
BranchOrTag(String)
From a reference that’s ambiguously a branch or tag.
BranchOrTagOrCommit(String)
From a reference that’s ambiguously a commit, branch, or tag.
NamedRef(String)
From a named reference, like refs/pull/493/head.
DefaultBranch
The default branch of the repository, the reference named HEAD.
Implementations§
Source§impl GitReference
impl GitReference
Sourcepub fn from_rev(rev: String) -> Self
pub fn from_rev(rev: String) -> Self
Creates a GitReference from an arbitrary revision string, which could represent a
branch, tag, commit, or named ref.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Converts the GitReference to a str.
Sourcepub fn as_rev(&self) -> &str
pub fn as_rev(&self) -> &str
Converts the GitReference to a str that can be used as a revision.
Trait Implementations§
Source§impl Clone for GitReference
impl Clone for GitReference
Source§fn clone(&self) -> GitReference
fn clone(&self) -> GitReference
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GitReference
impl Debug for GitReference
Source§impl Display for GitReference
impl Display for GitReference
Source§impl Hash for GitReference
impl Hash for GitReference
Source§impl Ord for GitReference
impl Ord for GitReference
Source§fn cmp(&self, other: &GitReference) -> Ordering
fn cmp(&self, other: &GitReference) -> Ordering
1.21.0 · 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 PartialEq for GitReference
impl PartialEq for GitReference
Source§impl PartialOrd for GitReference
impl PartialOrd for GitReference
impl Eq for GitReference
impl StructuralPartialEq for GitReference
Auto Trait Implementations§
impl Freeze for GitReference
impl RefUnwindSafe for GitReference
impl Send for GitReference
impl Sync for GitReference
impl Unpin for GitReference
impl UnwindSafe for GitReference
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