pub struct PrCache { /* private fields */ }Implementations§
Source§impl PrCache
impl PrCache
Sourcepub fn state(&self, branch: &str) -> Option<&PrState>
pub fn state(&self, branch: &str) -> Option<&PrState>
Return the PR state for branch, if known.
branch must be in the same form that gh pr list returns for
headRefName — i.e. without a refs/heads/ prefix. Callers in
display.rs pass branch_name which comes from
git::normalize_branch_name, which strips refs/heads/ so the form
matches gh’s output.
Sourcepub fn from_disk(repo: &Path) -> Option<Self>
pub fn from_disk(repo: &Path) -> Option<Self>
Try loading a fresh cache entry from disk. Returns None if the file
is missing, expired, corrupt, or in the future (clock skew guard).
Sourcepub fn fetch_and_persist(repo: &Path) -> Self
pub fn fetch_and_persist(repo: &Path) -> Self
Fetch PR state via gh pr list and persist to disk. Returns an empty
cache on any failure so callers’ fallback path still works.
On failure, the on-disk cache (if any) is left untouched — only a successful fetch triggers a write.
Sourcepub fn load_or_fetch(repo: &Path, no_cache: bool) -> Self
pub fn load_or_fetch(repo: &Path, no_cache: bool) -> Self
Load from disk if fresh (and no_cache is false), else fetch via
gh pr list and persist. Returns an empty cache on any failure so
the caller’s fallback path still works.
When no_cache=true and gh is down, the previous on-disk cache is
preserved but not consulted; the next non-bypass call may serve stale
data until gh recovers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrCache
impl RefUnwindSafe for PrCache
impl Send for PrCache
impl Sync for PrCache
impl Unpin for PrCache
impl UnsafeUnpin for PrCache
impl UnwindSafe for PrCache
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<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