-
In this line from the "Hello Tokio" step, where is the client.set("hello", "world".into()).await?; |
Beta Was this translation helpful? Give feedback.
Answered by
barkanido
Feb 15, 2021
Replies: 1 comment
-
the pub async fn set(&mut self, key: &str, value: Bytes) -> crate::Result<()> which means that the This is the idiomatic way for type conversions in Rust. For more information about how it works, you can read about the From trait. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Darksonn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the
set
fn is of typewhich means that the
&str
"world" is converted intoBytes
usinginto()
.into
is automatically generated by the compiler because theBytes
struct is implementing severalfrom
methods. see here.This is the idiomatic way for type conversions in Rust. For more information about how it works, you can read about the From trait.