pub struct DiskItemsCache { /* private fields */ }Expand description
SHA-keyed cache of parsed public-API items, persisted as JSON.
Implementations§
Source§impl DiskItemsCache
impl DiskItemsCache
Sourcepub fn load_at(path: PathBuf) -> Self
pub fn load_at(path: PathBuf) -> Self
Load (or initialize empty) at the given file path. Missing or corrupt cache files are silently treated as empty so a stale cache never blocks a scan.
Sourcepub fn load_default() -> Self
pub fn load_default() -> Self
Convenience: load from the default cache directory.
pub fn get(&self, sha: &str, lang: Language) -> Option<Vec<String>>
pub fn insert(&mut self, sha: String, lang: Language, items: Vec<String>)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Persist to disk. Creates the parent directory if necessary. Errors are returned to the caller — callers typically log and proceed (a save failure shouldn’t crash a successful scan).
pub fn path(&self) -> &Path
Trait Implementations§
Source§impl Debug for DiskItemsCache
impl Debug for DiskItemsCache
Source§impl Default for DiskItemsCache
impl Default for DiskItemsCache
Source§fn default() -> DiskItemsCache
fn default() -> DiskItemsCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DiskItemsCache
impl RefUnwindSafe for DiskItemsCache
impl Send for DiskItemsCache
impl Sync for DiskItemsCache
impl Unpin for DiskItemsCache
impl UnsafeUnpin for DiskItemsCache
impl UnwindSafe for DiskItemsCache
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