pub enum GitHead {
Symbolic(SymbolicRef),
Detached(String),
Unborn,
}Expand description
A lightweight HEAD vocabulary value.
Variants§
Symbolic(SymbolicRef)
HEAD exists as a symbolic ref.
Detached(String)
HEAD names object identifier text directly.
Unborn
HEAD is known as vocabulary, but no target is modeled.
Implementations§
Source§impl GitHead
impl GitHead
Sourcepub const fn symbolic(target: GitRefName) -> GitHead
pub const fn symbolic(target: GitRefName) -> GitHead
Creates symbolic HEAD from a target ref name.
Sourcepub fn detached(value: impl AsRef<str>) -> Result<GitHead, GitRefParseError>
pub fn detached(value: impl AsRef<str>) -> Result<GitHead, GitRefParseError>
Creates detached HEAD from object identifier text.
§Errors
Returns GitRefParseError::EmptyDetachedTarget when the supplied text is empty.
Sourcepub const fn is_symbolic(&self) -> bool
pub const fn is_symbolic(&self) -> bool
Returns true when HEAD is symbolic.
Sourcepub const fn is_detached(&self) -> bool
pub const fn is_detached(&self) -> bool
Returns true when HEAD is detached.
Sourcepub const fn symbolic_ref(&self) -> Option<&SymbolicRef>
pub const fn symbolic_ref(&self) -> Option<&SymbolicRef>
Returns the symbolic target when present.
Trait Implementations§
impl Eq for GitHead
impl StructuralPartialEq for GitHead
Auto Trait Implementations§
impl Freeze for GitHead
impl RefUnwindSafe for GitHead
impl Send for GitHead
impl Sync for GitHead
impl Unpin for GitHead
impl UnsafeUnpin for GitHead
impl UnwindSafe for GitHead
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