pub struct Index {
pub cache_version: u32,
pub plugins: BTreeMap<String, IndexEntry>,
}Expand description
Contents of .plugins.json.
Fields§
§cache_version: u32Schema version.
plugins: BTreeMap<String, IndexEntry>Crate name → install record.
Implementations§
Source§impl Index
impl Index
Sourcepub fn load(path: &Path) -> Self
pub fn load(path: &Path) -> Self
Reads the cache. A missing or unparsable file yields an empty index — the cache is not a source of truth.
Sourcepub fn save(&self, path: &Path) -> KitResult<()>
pub fn save(&self, path: &Path) -> KitResult<()>
Writes the cache (atomic replace: write a temp file, then rename).
Sourcepub fn insert(&mut self, crate_name: &str, entry: IndexEntry)
pub fn insert(&mut self, crate_name: &str, entry: IndexEntry)
Records one entry.
Sourcepub fn remove(&mut self, crate_name: &str) -> Option<IndexEntry>
pub fn remove(&mut self, crate_name: &str) -> Option<IndexEntry>
Removes one entry.
Sourcepub fn get(&self, crate_name: &str) -> Option<&IndexEntry>
pub fn get(&self, crate_name: &str) -> Option<&IndexEntry>
Looks up one entry.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Index
impl<'de> Deserialize<'de> for Index
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
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