pub struct PluginState {
pub plugins: HashMap<String, PluginStateEntry>,
}Expand description
Top-level plugin state file, stored at {data_dir}/plugin-state.json.
Fields§
§plugins: HashMap<String, PluginStateEntry>Implementations§
Source§impl PluginState
impl PluginState
Sourcepub fn load(data_dir: &Path) -> Self
pub fn load(data_dir: &Path) -> Self
Load plugin state from a data directory. Returns default (empty) if the file doesn’t exist or can’t be parsed.
Sourcepub fn is_enabled(&self, id: &str) -> bool
pub fn is_enabled(&self, id: &str) -> bool
Check whether a plugin is enabled. Returns true if the plugin has
no state entry (default is enabled).
Sourcepub fn enable(&mut self, id: &str) -> Result<()>
pub fn enable(&mut self, id: &str) -> Result<()>
Enable a plugin. Creates an entry if one doesn’t exist.
Sourcepub fn disable(&mut self, id: &str) -> Result<()>
pub fn disable(&mut self, id: &str) -> Result<()>
Disable a plugin. Creates an entry if one doesn’t exist.
Sourcepub fn record_install(&mut self, id: &str, version: &str, source: &str)
pub fn record_install(&mut self, id: &str, version: &str, source: &str)
Record that a plugin was installed.
Trait Implementations§
Source§impl Clone for PluginState
impl Clone for PluginState
Source§fn clone(&self) -> PluginState
fn clone(&self) -> PluginState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PluginState
impl Debug for PluginState
Source§impl Default for PluginState
impl Default for PluginState
Source§fn default() -> PluginState
fn default() -> PluginState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PluginState
impl<'de> Deserialize<'de> for PluginState
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 PluginState
impl RefUnwindSafe for PluginState
impl Send for PluginState
impl Sync for PluginState
impl Unpin for PluginState
impl UnsafeUnpin for PluginState
impl UnwindSafe for PluginState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read more