@@ -341,7 +341,8 @@ Cargo’s use of external crates is where it really shines. Before we can write
341341code that uses ` rand ` , we need to modify the * Cargo.toml* file to include the
342342` rand ` crate as a dependency. Open that file now and add the following line to
343343the bottom beneath the ` [dependencies] ` section header that Cargo created for
344- you (be sure to use version ` 0.8.3 ` or the code examples in this tutorial may not work!):
344+ you. Be sure to specify ` rand ` exactly as we have here, or the code examples in
345+ this tutorial may not work.
345346
346347<!-- When updating the version of `rand` used, also update the version of
347348`rand` used in these files so they all match:
@@ -364,7 +365,10 @@ Versioning][semver]<!-- ignore --> (sometimes called *SemVer*), which is a
364365standard for writing version numbers. The number ` 0.8.3 ` is actually shorthand
365366for ` ^0.8.3 ` , which means any version that is at least ` 0.8.3 ` but below
366367` 0.9.0 ` . Cargo considers these versions to have public APIs compatible with
367- version ` 0.8.3 ` .
368+ version ` 0.8.3 ` , and this specification ensures you'll get the latest patch
369+ release that will still compile with the code in this chapter. Any version
370+ ` 0.9.0 ` or greater is not guaranteed to have the same API as what the following
371+ examples use.
368372
369373[ semver ] : http://semver.org
370374
@@ -413,9 +417,9 @@ their open source Rust projects for others to use.
413417
414418After updating the registry, Cargo checks the ` [dependencies] ` section and
415419downloads any crates you don’t have yet. In this case, although we only listed
416- ` rand ` as a dependency, Cargo also grabbed ` libc ` and ` rand_core ` , because
417- ` rand ` depends on those to work. After downloading the crates, Rust compiles
418- them and then compiles the project with the dependencies available.
420+ ` rand ` as a dependency, Cargo also grabbed other crates that ` rand ` depends on
421+ to work. After downloading the crates, Rust compiles them and then compiles the
422+ project with the dependencies available.
419423
420424If you immediately run ` cargo build ` again without making any changes, you
421425won’t get any output aside from the ` Finished ` line. Cargo knows it has already
@@ -532,13 +536,13 @@ Next, we’re adding two lines in the middle. The `rand::thread_rng` function
532536will give us the particular random number generator that we’re going to use:
533537one that is local to the current thread of execution and seeded by the
534538operating system. Then we call the ` gen_range ` method on the random number
535- generator. This method is defined by the ` Rng ` trait that we brought into
536- scope with the ` use rand::Rng ` statement. The ` gen_range ` method takes a
537- range expression as an argument and generates a random number in the range.
538- A range expression takes the form start ` .. ` end. It’s inclusive on the lower
539- bound but exclusive on the upper bound, so we need to specify ` 1..101 ` to
540- request a number between 1 and 100. Alternatively, we could pass the range
541- ` 1..=100 ` , which is equivalent.
539+ generator. This method is defined by the ` Rng ` trait that we brought into scope
540+ with the ` use rand::Rng ` statement. The ` gen_range ` method takes a range
541+ expression as an argument and generates a random number in the range. The kind
542+ of range expression we’re using here takes the form ` start.. end` . It’s
543+ inclusive on the lower bound but exclusive on the upper bound, so we need to
544+ specify ` 1..101 ` to request a number between 1 and 100. Alternatively, we could
545+ pass the range ` 1..=100 ` , which is equivalent.
542546
543547> Note: You won’t just know which traits to use and which methods and functions
544548> to call from a crate. Instructions for using a crate are in each crate’s
0 commit comments