pub struct GitBranchModule;Expand description
Module that displays the current Git branch
Shows the branch name when on a branch, or a short SHA when in detached HEAD state. Only displays when inside a git repository.
§Configuration
[git_branch]
format = "[$symbol$branch(:$remote_branch)]($style)"
style = "bold purple"
symbol = ""
disabled = false§Display Behavior
- Branch name: Shows current branch (e.g., “main”, “feature/xyz”)
- Detached HEAD: Shows short commit SHA
- Outside repo: Module is hidden
Implementations§
Source§impl GitBranchModule
impl GitBranchModule
pub fn new() -> Self
pub fn from_context(_context: &Context) -> Self
Trait Implementations§
Source§impl Default for GitBranchModule
impl Default for GitBranchModule
Source§impl Module for GitBranchModule
impl Module for GitBranchModule
Source§fn should_display(&self, context: &Context, config: &dyn ModuleConfig) -> bool
fn should_display(&self, context: &Context, config: &dyn ModuleConfig) -> bool
Determines if this module should be displayed
Auto Trait Implementations§
impl Freeze for GitBranchModule
impl RefUnwindSafe for GitBranchModule
impl Send for GitBranchModule
impl Sync for GitBranchModule
impl Unpin for GitBranchModule
impl UnsafeUnpin for GitBranchModule
impl UnwindSafe for GitBranchModule
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more