pub struct Store { /* private fields */ }
Expand description
Represents a key-value store
Implementations§
Source§impl Store
impl Store
Sourcepub fn new(connection: &str) -> Result<Store, Box<dyn Error>>
pub fn new(connection: &str) -> Result<Store, Box<dyn Error>>
Returns a new yocto store
§Arguments
connection
- A string slice that holds the endpoint of the yocto server
Sourcepub fn get(&self, key: &str) -> Result<Option<String>, Box<dyn Error>>
pub fn get(&self, key: &str) -> Result<Option<String>, Box<dyn Error>>
Locates the given key inside the database and returns an Ok with the corresponding value if existing or an None if not.
§Arguments
key
- A string slice that holds the key to look up
Sourcepub fn insert(
&self,
key: &str,
value: &str,
) -> Result<Option<String>, Box<dyn Error>>
pub fn insert( &self, key: &str, value: &str, ) -> Result<Option<String>, Box<dyn Error>>
Inserts a value for a specified key. Returns the old value if existent.
§Arguments
key
- A string slice that holds the key to insert the value forvalue
- The value to insert
Auto Trait Implementations§
impl Freeze for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnwindSafe for Store
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