pub struct PrBadge {
pub number: u64,
pub is_draft: bool,
pub checks: PrCheckState,
pub url: String,
pub head_oid: String,
}Expand description
The PR badge shown on a worktree row: which PR heads this branch and how its CI is doing.
isDraft is camelCase on the wire — the extension’s PrBadge inherited
the name from gh’s JSON output before badges moved daemon-side, and every
consumer already reads that key. Renaming it to match the payload’s otherwise
snake_case convention would silently drop the draft marker.
Fields§
§number: u64The PR number, e.g. 1337.
is_draft: boolWhether the PR is a draft.
checks: PrCheckStateThe rolled-up CI verdict.
url: StringThe PR’s web URL, for the open action.
head_oid: StringThe commit on the remote branch that checks describes.
Not on the wire — it exists so the snapshot fold can tell a verdict
computed for some commit from one computed for the commit the worktree
actually has checked out. Without it a badge cannot know it is out of date,
and the previous head’s verdict stands until the next poll (#1337). See
is_stale_for.
Implementations§
Source§impl PrBadge
impl PrBadge
Sourcepub fn is_stale_for(&self, head_sha: Option<&str>) -> bool
pub fn is_stale_for(&self, head_sha: Option<&str>) -> bool
Whether this verdict describes a commit other than head_sha.
The check is deliberately “different”, not “older”: we cannot order two commits without a walk, and every way they can differ means the same thing — this verdict is not about the commit in front of you. You pushed and CI has not reported yet; you have unpushed work; you are behind the remote.
This is what makes a push invalidate the badge immediately, with no network
call: the cache still holds the previous commit’s oid, so the mismatch is
visible on the very next snapshot. A None head (an unborn HEAD) is not
stale — there is nothing to compare, and such a worktree has no branch and so
no badge anyway.
Trait Implementations§
impl Eq for PrBadge
impl StructuralPartialEq for PrBadge
Auto Trait Implementations§
impl Freeze for PrBadge
impl RefUnwindSafe for PrBadge
impl Send for PrBadge
impl Sync for PrBadge
impl Unpin for PrBadge
impl UnsafeUnpin for PrBadge
impl UnwindSafe for PrBadge
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.