use bytes::Bytes; use dstore::Local; use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box> { let l1 = Local::new("[::1]:50051".to_string(), "[::1]:50052".to_string()) .await .unwrap(); let l2 = Local::new("[::1]:50051".to_string(), "[::1]:50053".to_string()) .await .unwrap(); l1.lock() .await .insert(Bytes::from("Capital"), Bytes::from("Punishment")) .await; if let Ok(value) = l1.lock().await.get(&Bytes::from("Capital")).await { println!("{}", String::from_utf8(value.to_vec()).unwrap()); } if let Ok(value) = l2.lock().await.get(&Bytes::from("Capital")).await { println!("{}", String::from_utf8(value.to_vec()).unwrap()); } Ok(()) }