pub struct Store {
pub data: Vec<KV>,
}
Expand description
Represents the in-memory key-value store.
Creates a new, empty Store
.
§Returns
A new instance of Store
.
Inserts a key-value pair into the store.
and save the new data into file
§Arguments
key
- The key to insert.
value
- The value to associate with the key.
§Returns
Ok(())
if the insertion is successful.
Err(&str)
if the key already exists.
Retrieves a mutable reference to the key-value pair associated with the given key.
§Arguments
key
- The key to search for.
§Returns
Ok(&mut KV)
if the key is found.
Err(&str)
if the key is not found.
Updates the value associated with the given key.
and save the new data into file
§Arguments
key
- The key to update.
value
- The new value to associate with the key.
§Returns
Ok(())
if the update is successful.
Err(String)
if the key is not found.
Deletes the key-value pair associated with the given key.
§Arguments
Formats the value using the given formatter.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.