which is more current ? why both ?
Both are the same.
You can access the docs from any stable Rust release at
doc.rust-lang.org/<VERSION>. For example: doc.rust-lang.org/1.50.0
You can also use the special version names "stable", "beta", and "nightly" to access docs for the latest version on each of those channels, for example: doc.rust-lang.org/beta
The URL without any version name is a shorthand for the latest stable release.
The most difficult part of my journey into Rust has been (and still is) navigating the plethora of online Rust tutorial docs. I'm still looking for a decent doc that quickly conveys key information related to the current Rust version. The best I've found so far is Introduction - Rust By Example
My biggest frustration has been finding a decent document on Rust-style Error Handling . It my current understanding (or perhaps mis-understanding) that unwrap(), matching, try! etc. are no longer recommended and that one should use Result< > and operator ?... but I cant find any docs focused on the latter
The Rust Programming Language (a.k.a. “The Book”) is the most official, up-to-date tutorial documentation. The section on
? is at Recoverable Errors with Result - The Rust Programming Language.
x? has the exact same semantics as the old
try!(x) macro. Only the syntax has changed. So if you are reading some old example code that uses
try!, you can easily translate it to use
If you're looking for something much more concise than the book, A half-hour to learn Rust is extremely short, and recent enough to be up-to-date with current Rust. It doesn't cover everything but it's a good whirlwind tour.
However, I do recommend taking the time to read the Book. Rust has a lot of tricky concepts that may look similar to other languages, but have subtle and important differences. It's worth the time to learn them fully, and not just copy example code or guess what things mean. I'm a big fan of learning by reading and writing code, but I found this approach did not work well for learning Rust.
Lastly, if you find yourself reading old Rust code for whatever reason, The Edition Guide has a fairly quick summary of the major changes between Rust 1.0 and more recent versions. For example, it covers the introduction of the
Generally when you need to find the API reference of any library, the easiest way is to navigate to
docs.rs/[library name here]
This also works for std, as
docs.rs/std redirects to the standard library docs.
This way is guaranteed to give the latest version of the library you are looking for.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.