File tree Expand file tree Collapse file tree 3 files changed +4
-5
lines changed
tutorial-code/hello-tokio Expand file tree Collapse file tree 3 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ pub async fn main() -> Result<()> {
40
40
let mut client = client :: connect (" 127.0.0.1:6379" ). await ? ;
41
41
42
42
// Set the key "hello" with value "world"
43
- client . set (" hello" , bytes :: Bytes :: from ( " world" )). await ? ;
43
+ client . set (" hello" , " world" . into ( )). await ? ;
44
44
45
45
// Get key "hello"
46
46
let result = client . get (" hello" ). await ? ;
@@ -139,8 +139,8 @@ pub async fn connect<T: ToSocketAddrs>(addr: T) -> Result<Client> {
139
139
140
140
The ` async fn ` definition looks like a regular synchronous function, but
141
141
operates asynchronously. Rust transforms the ` async fn ` at ** compile** time into
142
- a routine that operates asynchronously. Any calls to ` .await ` within the
143
- ` async fn` yield control back to the thread. The thread may do other work while the
142
+ a routine that operates asynchronously. Any calls to ` .await ` within the `async
143
+ fn` yield control back to the thread. The thread may do other work while the
144
144
operation processes in the background.
145
145
146
146
[[ warning]]
Original file line number Diff line number Diff line change @@ -8,6 +8,5 @@ publish = false
8
8
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9
9
10
10
[dependencies ]
11
- bytes = " 1.0.1"
12
11
tokio = { version = " 1" , features = [" full" ] }
13
12
mini-redis = " 0.4"
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ async fn main() -> mini_redis::Result<()> {
6
6
let mut client = client:: connect ( "127.0.0.1:6379" ) . await ?;
7
7
8
8
// Set the key "hello" with value "world"
9
- client. set ( "hello" , bytes :: Bytes :: from ( "world" ) ) . await ?;
9
+ client. set ( "hello" , "world" . into ( ) ) . await ?;
10
10
11
11
// Get key "hello"
12
12
let result = client. get ( "hello" ) . await ?;
You can’t perform that action at this time.
0 commit comments