mirror of
https://github.com/Drop-OSS/dropbreak.git
synced 2026-07-18 09:57:53 -04:00
Update documentation
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
Rustbreak
|
||||
=========
|
||||
|
||||
[](https://travis-ci.org/TheNeikos/rustbreak)
|
||||
|
||||
**[Documentation][doc]**
|
||||
|
||||
Rustbreak is an [Daybreak](https://propublica.github.io/daybreak/) inspired file
|
||||
@@ -9,15 +11,35 @@ database. It is meant to be fast and simple to use.
|
||||
Features
|
||||
--------
|
||||
|
||||
- Simple, Fast
|
||||
- Simple To Use, Fast, Secure
|
||||
- Threadsafe
|
||||
|
||||
Examples
|
||||
--------
|
||||
Usage
|
||||
-----
|
||||
|
||||
TODO: To be done
|
||||
Usage is quite simple:
|
||||
|
||||
- Create/open a database using `Database::open`
|
||||
- You can specify the kind of Key you want using this Syntax:
|
||||
`Database::<Key>::open`
|
||||
- `Insert`/`Retrieve` data from the Database
|
||||
- Don't forget to run `flush` periodically
|
||||
|
||||
```rust
|
||||
use rustbreak::Database;
|
||||
|
||||
fn main() {
|
||||
let db = Database::open("my_contacts").unwrap();
|
||||
|
||||
db.insert("Lapfox", "lapfoxtrax.com").unwrap();
|
||||
db.insert("Rust", "github.com/rust-lang/rust").unwrap();
|
||||
|
||||
// we need to be explicit about the kind of type we want as println! is
|
||||
// generic
|
||||
let rust : String = db.retrieve("Rust").unwrap();
|
||||
println!("You can find Rust at: {}", rust);
|
||||
db.flush().unwrap();
|
||||
}
|
||||
```
|
||||
|
||||
[doc]:http://neikos.me/rustbreak/rustbreak/index.html
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
extern crate rustbreak;
|
||||
|
||||
use rustbreak::Database;
|
||||
|
||||
fn main() {
|
||||
let mut db = Database::open("my_contacts").unwrap();
|
||||
|
||||
db.insert("Lapfox", "lapfoxtrax.com").unwrap();
|
||||
db.insert("Rust", "github.com/rust-lang/rust").unwrap();
|
||||
|
||||
// we need to be explicit about the kind of type we want as println! is generic
|
||||
let rust : String = db.retrieve("Rust").unwrap();
|
||||
println!("You can find Rust at: {}", rust);
|
||||
db.flush().unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user