pub struct PluginStorage { /* private fields */ }Expand description
SQLite-backed per-plugin KV store. Cheap to clone (wraps an Arc).
Implementations§
Source§impl PluginStorage
impl PluginStorage
Sourcepub fn open(path: PathBuf) -> Result<Self>
pub fn open(path: PathBuf) -> Result<Self>
Open (or create) the store at a specific path and run migrations.
Sourcepub async fn get(
&self,
plugin_id: &str,
namespace: &str,
key: &str,
) -> Result<Option<String>>
pub async fn get( &self, plugin_id: &str, namespace: &str, key: &str, ) -> Result<Option<String>>
Read a value. Ok(None) when the key is unset.
Sourcepub async fn set(
&self,
plugin_id: &str,
namespace: &str,
key: &str,
value: &str,
) -> Result<()>
pub async fn set( &self, plugin_id: &str, namespace: &str, key: &str, value: &str, ) -> Result<()>
Upsert a value.
Trait Implementations§
Source§impl Clone for PluginStorage
impl Clone for PluginStorage
Source§fn clone(&self) -> PluginStorage
fn clone(&self) -> PluginStorage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PluginStorage
impl !UnwindSafe for PluginStorage
impl Freeze for PluginStorage
impl Send for PluginStorage
impl Sync for PluginStorage
impl Unpin for PluginStorage
impl UnsafeUnpin for PluginStorage
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