Crates.io | twinkle |
lib.rs | twinkle |
version | 0.1.3 |
source | src |
created_at | 2019-12-14 11:35:26.075117 |
updated_at | 2019-12-26 04:45:12.10799 |
description | Client library for twinkle |
homepage | |
repository | https://github.com/kirisaki/twinkle-rust |
max_upload_size | |
id | 189336 |
size | 18,080 |
Binding of Twinkle for Rust.
Cargo.toml
[dependencies]
twinkle = "0.1"
futures = "0.3"
tokio = { version = "0.2", features = ["full"] }
main.rs
use futures::future::{join};
#[tokio::main]
async fn main(){
let (client, manager) = twinkle::open("127.0.0.1:3000").await.unwrap();
join(manager.run(), your_app(client));
}
async fn your_app(mut c: twinkle::Client) {
c.ping().await;
c.set(b"hoge".to_vec(), b"foo".to_vec()).await;
c.get(b"hoge".to_vec()).await;
c.unset(b"hoge".to_vec()).await;
}