Crates.io | lexi-rs |
lib.rs | lexi-rs |
version | 0.1.9 |
source | src |
created_at | 2023-10-01 00:31:13.061265 |
updated_at | 2024-01-17 22:00:27.403958 |
description | a client for lexidb - an in memory data structure database |
homepage | |
repository | |
max_upload_size | |
id | 988941 |
size | 25,241 |
a rust client for lexidb, an in memory data structure database.
$ cargo add lexi-rs
currently, values that are set must implement Into
use lexi;
use anyhow;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut client = Client::new(<address>)?;
client.connect.await?;
let set_res = client.set("key", "value").await?;
assert_eq!(set_res, lexi::LexiType::Simple(SimpleString::Ok));
let get_res = client.get("key").await?;
assert_eq!(get_res, lexi::LexiType::BulkString("value".to_owned()));
let del_res = client.del("key").await?;
assert_eq!(del_res, lexi::LexiType::Simple(SimpleString::Ok));
Ok(())
}
let push_res = client.push("vince").await?;
assert_eq!(push_res, LexiType::Simple(SimpleString::Ok));
let pop_res = client.pop().await?;
assert_eq!(pop_res, LexiType::BulkString("vince".to_owned());
let enque_res = client.enque("vince").await?;
assert_eq!(enque_res, LexiType::Simple(SimpleString::Ok));
let deque_res = client.deque().await?;
assert_eq!(deque_res, LexiType::BulkString("vince".to_owned());