[−][src]Struct leetup_cache::kvstore::KvStore
The KvStore
stores string key/value pairs.
Key/value pairs are persisted to disk in log files. Log files are named after
monotonically increasing generation numbers with a log
extension name.
A BTreeMap
in memory stores the keys and the value locations for fast query.
use std::env::current_dir; let mut store = KvStore::open(current_dir()?)?; store.set("key".to_owned(), "value".to_owned())?; let val = store.get("key".to_owne())?; assert_eq!(val, Some("value".to_owned()));
Implementations
impl KvStore
[src]
pub fn open<T: Into<PathBuf>>(path: T) -> Result<Self>
[src]
Opens a KvStore with the given path.
pub fn set(&mut self, key: String, value: String) -> Result<()>
[src]
Sets the value of s string key to a string.
pub fn get(&mut self, key: String) -> Result<Option<String>>
[src]
Gets the string value for a given key.
pub fn remove(&mut self, key: String) -> Result<()>
[src]
Removes the given key.
Auto Trait Implementations
impl RefUnwindSafe for KvStore
impl Send for KvStore
impl Sync for KvStore
impl Unpin for KvStore
impl UnwindSafe for KvStore
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,