pub struct MagitHeaderline { /* private fields */ }Expand description
The one [Headerline] impl behind every magit buffer’s header row.
Implementations§
Source§impl MagitHeaderline
impl MagitHeaderline
Sourcepub fn new(
theme: Option<ThemeRegistryHandle>,
mode_id: &str,
) -> MagitHeaderlineHandle
pub fn new( theme: Option<ThemeRegistryHandle>, mode_id: &str, ) -> MagitHeaderlineHandle
Build a headerline that resolves its colours through theme
(None — a harness with no theme registry — falls back to
fixed tones). Starts empty, so it renders nothing until the
owning mode publishes its first fields.
install wraps this and registers the result as a
virtual-row provider; benches construct one directly to measure
the row in isolation.
Sourcepub fn set(&self, fields: Vec<Field>) -> bool
pub fn set(&self, fields: Vec<Field>) -> bool
Replace the row’s fields. Returns true when something changed
(and the version was bumped); false is the no-work path a
refresh that found identical data takes.
Sourcepub fn set_busy(&self, busy: bool) -> bool
pub fn set_busy(&self, busy: bool) -> bool
MG.27: mark a refresh as in flight (or finished).
Kept OUT of fields deliberately. Every refresh path ends by
calling Self::set with freshly-computed fields, so a busy
marker living in that vector would be wiped by the very
completion it is supposed to survive until — and worse, would
have to be re-added by each builder, which is a rule every new
view could forget. A separate flag composes instead: builders
stay ignorant of it and cannot drop it.
Returns true when the state actually changed, matching
Self::set’s contract — the version is only bumped then, so
a refresh that starts and finishes between two ticks costs no
repaint.
pub fn is_busy(&self) -> bool
Sourcepub fn set_notice(&self, text: Option<String>) -> bool
pub fn set_notice(&self, text: Option<String>) -> bool
MG.56: set (or clear) the one-line notice about the last action.
For the outcome that is neither success nor error: the operation ran, git answered, and the answer was nothing. Toggling a file’s diff when the file no longer has the changes the buffer still lists produces an empty patch, and an empty patch inserted is indistinguishable from a key that did not fire — so the user presses it again, and again.
Returns true when the state actually changed, matching
Self::set and Self::set_busy: the version is only bumped
then, so re-notifying the same thing costs no repaint.
pub fn notice(&self) -> Option<String>
Sourcepub fn content_version(&self) -> u64
pub fn content_version(&self) -> u64
The row’s own content version, ignoring the theme. Test seam —
[Headerline::version] folds the theme’s version in, which
would make “did the content change?” unobservable on its own.
Trait Implementations§
Source§impl Debug for MagitHeaderline
impl Debug for MagitHeaderline
Auto Trait Implementations§
impl !Freeze for MagitHeaderline
impl !RefUnwindSafe for MagitHeaderline
impl !UnwindSafe for MagitHeaderline
impl Send for MagitHeaderline
impl Sync for MagitHeaderline
impl Unpin for MagitHeaderline
impl UnsafeUnpin for MagitHeaderline
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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