mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 23:50:25 +08:00
Fancy quotes now for better diffs later
This commit is contained in:
parent
8260c118f9
commit
435565175d
@ -32,7 +32,7 @@ mod tests {
|
||||
```
|
||||
|
||||
Cargo creates an empty test to help us get our library started, rather
|
||||
than the "Hello, world!" binary that we get with the `--bin` option. We’ll look
|
||||
than the “Hello, world!” binary that we get with the `--bin` option. We’ll look
|
||||
at the `#[]` and `mod tests` syntax a little later, but for now just make sure
|
||||
to leave it in your *src/lib.rs*.
|
||||
|
||||
@ -147,7 +147,7 @@ communicator
|
||||
You can see that in Listing 7-2, `client` is a child of the `network` module,
|
||||
rather than a sibling. More complicated projects can have a lot of modules, and
|
||||
they’ll need to be orgnaized logically in order to keep track of them. What
|
||||
"logically" means in your project is up to you and depends on how you and users
|
||||
“logically” means in your project is up to you and depends on how you and users
|
||||
of your library think about your project’s domain. Use the techniques we’ve
|
||||
shown here to create side-by-side modules and nested modules in whatever
|
||||
structure you would like.
|
||||
|
@ -81,7 +81,7 @@ our call to that function from our binary crate be allowed, the warning that
|
||||
the function is unused will go away. Marking something public lets Rust know
|
||||
that we intend for the function to be used by code outside of our program. Rust
|
||||
considers the theoretical external usage that’s now possible as the function
|
||||
"being used." Thus, when something is marked as public, Rust will not require
|
||||
“being used.” Thus, when something is marked as public, Rust will not require
|
||||
that it’s used in our own program and will stop warning that the item is
|
||||
unused.
|
||||
|
||||
@ -90,7 +90,7 @@ unused.
|
||||
To tell Rust to make something public, we add the `pub` keyword to the start of
|
||||
the declaration of the item we want to make public. We’ll focus on fixing the
|
||||
warning that tells us that `client::connect` has gone unused for now, as well
|
||||
as the "module `client` is private" error from our binary crate. Modify
|
||||
as the “module `client` is private” error from our binary crate. Modify
|
||||
`src/lib.rs` to make the `client` module public, like so:
|
||||
|
||||
Filename: src/lib.rs
|
||||
@ -113,7 +113,7 @@ error: function `connect` is private
|
||||
```
|
||||
|
||||
Hooray! We have a different error! Yes, different error messages are a cause
|
||||
for celebration. The new error says "function `connect` is private", so let’s
|
||||
for celebration. The new error says “function `connect` is private”, so let’s
|
||||
edit `src/client.rs` to make `client::connect` public too:
|
||||
|
||||
Filename: src/client.rs
|
||||
|
Loading…
Reference in New Issue
Block a user