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: 4 months 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 (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-26T23:09:02.000Z (about 4 years ago)
- Last Synced: 2025-01-28T11:50:36.140Z (5 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(())
}
```