]> piware.de Git - learn-rust.git/blob - tokio-tutorial-mini-redis/src/main.rs
a49865584dc70a67904e2e95634c4e5cbfe01a62
[learn-rust.git] / tokio-tutorial-mini-redis / src / main.rs
1 use mini_redis::{client, Result};
2
3 #[tokio::main]
4 async fn main() -> Result<()> {
5     // Open a connection to the mini-redis address.
6     let mut client = client::connect("127.0.0.1:6379").await?;
7
8     // Set the key "hello" with value "world"
9     client.set("hello", "world".into()).await?;
10
11     // Get key "hello"
12     let result = client.get("hello").await?;
13
14     println!("got value from the server; result={:?}", result);
15
16     Ok(())
17 }