pub struct InstalledPlugins {
pub plugins: Vec<InstalledPlugin>,
}Expand description
The full installed.json document: { "plugins": [ ... ] }.
Fields§
§plugins: Vec<InstalledPlugin>Implementations§
Source§impl InstalledPlugins
impl InstalledPlugins
Sourcepub async fn load(path: &Path) -> PluginResult<Self>
pub async fn load(path: &Path) -> PluginResult<Self>
Load from path. A missing file is treated as an empty registry (this
is the state before any plugin has ever been installed) rather than an
error.
Sourcepub async fn save(&self, path: &Path) -> PluginResult<()>
pub async fn save(&self, path: &Path) -> PluginResult<()>
Persist to path, creating parent directories as needed.
Writes to a sibling <path>.tmp first, then renames it over path
— rename is atomic on the same filesystem (and <path>.tmp sits
right next to path, guaranteeing that), so a hard kill mid-write can
only ever leave a stray, harmless .tmp file behind, never a
truncated/corrupt installed.json a later load would choke on.
Sourcepub fn get(&self, id: &str) -> Option<&InstalledPlugin>
pub fn get(&self, id: &str) -> Option<&InstalledPlugin>
Look up a plugin by id.
Sourcepub fn add(&mut self, plugin: InstalledPlugin)
pub fn add(&mut self, plugin: InstalledPlugin)
Insert or replace (by id) — an upgrade re-adds the same id with a new version/registered set, so this is an upsert rather than an append.
Sourcepub fn remove(&mut self, id: &str) -> Option<InstalledPlugin>
pub fn remove(&mut self, id: &str) -> Option<InstalledPlugin>
Remove and return the entry for id, if any.
Sourcepub fn list(&self) -> &[InstalledPlugin]
pub fn list(&self) -> &[InstalledPlugin]
All installed plugins, in insertion order.
Trait Implementations§
Source§impl Clone for InstalledPlugins
impl Clone for InstalledPlugins
Source§fn clone(&self) -> InstalledPlugins
fn clone(&self) -> InstalledPlugins
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more