Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rawnly/simple-storage
Simple, fasst and easy to use key-value storage
https://github.com/rawnly/simple-storage
keyvaluestore rust
Last synced: about 1 month ago
JSON representation
Simple, fasst and easy to use key-value storage
- Host: GitHub
- URL: https://github.com/rawnly/simple-storage
- Owner: rawnly
- Created: 2021-05-25T22:57:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-26T23:09:02.000Z (over 3 years ago)
- Last Synced: 2024-10-12T17:56:02.009Z (2 months ago)
- Topics: keyvaluestore, rust
- Language: Rust
- Homepage: https://crates.io/crates/simple-storage
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Storage
> Simple, fast and easy to use key-value store.## Installation
```toml
# Cargo.toml
simple-storage = "0.0.2"
```## Usage
```rust
use std::io::Result;
use simple_storage::{Storage, Value};fn main() -> Result<()> {
let mut storage = Storage::new("/tmp/db.json");
storage.pull();// add key
storage.put("username", Value::String("rawnly"))?;// retrive key
let username = match storage.get("username") {
Some(username) => username,
Err(key_not_found_error) => "rawnly" // handle the error here
}
Ok(())
}
```