October 2018
Beginner
180 pages
4h 48m
English
As we noticed earlier, we can specify the type of a variable, but we often don't have to. That's because Rust has a feature called type inference, which often lets it figure out what type a variable is by looking at what we do with it. For example, if we were using the Tokio networking library, we might use code such as this:
let addr = "127.0.0.1:12345".parse()?;let tcp = TcpListener::bind(&addr)?;
We didn't specify what type the addr variable should have. Even more interesting, we didn't tell the text address what kind of information we needed it to parse into.
Read now
Unlock full access