pub struct Vault { /* private fields */ }Expand description
Thread-safe state storage for scanners
§Enterprise Design
- Thread-safe with RwLock
- Type-safe value storage
- Namespaced keys
- Clone-friendly (Arc
)
Implementations§
Source§impl Vault
impl Vault
Sourcepub fn set<K: Into<String>, V: Serialize>(
&self,
key: K,
value: V,
) -> Result<(), Error>
pub fn set<K: Into<String>, V: Serialize>( &self, key: K, value: V, ) -> Result<(), Error>
Store a value in the vault
Sourcepub fn get<K: AsRef<str>, V: for<'de> Deserialize<'de>>(
&self,
key: K,
) -> Result<Option<V>, Error>
pub fn get<K: AsRef<str>, V: for<'de> Deserialize<'de>>( &self, key: K, ) -> Result<Option<V>, Error>
Get a value from the vault
Sourcepub fn contains_key<K: AsRef<str>>(&self, key: K) -> bool
pub fn contains_key<K: AsRef<str>>(&self, key: K) -> bool
Check if a key exists
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Vault
impl RefUnwindSafe for Vault
impl Send for Vault
impl Sync for Vault
impl Unpin for Vault
impl UnwindSafe for Vault
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