pub struct DiskPrCache { /* private fields */ }Expand description
(owner, repo, sha)-keyed cache of pull-request lookups, persisted
as JSON. None values are stored explicitly to record “queried,
no PR found” — distinct from “never queried” (cache miss).
Implementations§
Source§impl DiskPrCache
impl DiskPrCache
pub fn load_at(path: PathBuf) -> Self
pub fn load_default() -> Self
Sourcepub fn get(
&self,
owner: &str,
repo: &str,
sha: &str,
) -> Option<Option<PullRequestRef>>
pub fn get( &self, owner: &str, repo: &str, sha: &str, ) -> Option<Option<PullRequestRef>>
Three-state lookup:
Some(Some(pr))— cached, PR foundSome(None)— cached, no PR for this commit (don’t re-query)None— not cached, caller should query the network
pub fn insert( &mut self, owner: &str, repo: &str, sha: &str, pr: Option<PullRequestRef>, )
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn save(&self) -> Result<()>
pub fn path(&self) -> &Path
Trait Implementations§
Source§impl Debug for DiskPrCache
impl Debug for DiskPrCache
Source§impl Default for DiskPrCache
impl Default for DiskPrCache
Source§fn default() -> DiskPrCache
fn default() -> DiskPrCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DiskPrCache
impl RefUnwindSafe for DiskPrCache
impl Send for DiskPrCache
impl Sync for DiskPrCache
impl Unpin for DiskPrCache
impl UnsafeUnpin for DiskPrCache
impl UnwindSafe for DiskPrCache
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