Skip to content

Commit

Permalink
Fix ListNumber0, newlines after lists
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Oct 20, 2022
1 parent c2bcf78 commit e593d2a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions nostarch/chapter08.md
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ employee names to a department in a company; for example, “Add Sally to
Engineering” or “Add Amir to Sales.” Then let the user retrieve a list of all
people in a department or all people in the company by department, sorted
alphabetically.

The standard library API documentation describes methods that vectors, strings,
and hash maps have that will be helpful for these exercises!

Expand Down
1 change: 1 addition & 0 deletions nostarch/chapter10.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Listing 10-3:
1. Extract the duplicate code into the body of the function, and specify the
inputs and return values of that code in the function signature.
1. Update the two instances of duplicated code to call the function instead.

Next, we’ll use these same steps with generics to reduce code duplication. In
the same way that the function body can operate on an abstract `list` instead
of specific values, generics allow code to operate on abstract types.
Expand Down
2 changes: 2 additions & 0 deletions nostarch/chapter12.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ expect.
1. Refactor the code you just added or changed and make sure the tests continue
to pass.
1. Repeat from step 1!

Though it’s just one of many ways to write software, TDD can help drive code
design. Writing the test before you write the code that makes the test pass
helps to maintain high test coverage throughout the process.
Expand Down Expand Up @@ -1128,6 +1129,7 @@ that and implement `search`, our program needs to follow these steps:
1. If it does, add it to the list of values we’re returning.
1. If it doesn’t, do nothing.
1. Return the list of results that match.

Let’s work through each step, starting with iterating through lines.

#### Iterating Through Lines with the lines Method
Expand Down
8 changes: 4 additions & 4 deletions nostarch/chapter16.md
Original file line number Diff line number Diff line change
Expand Up @@ -821,11 +821,11 @@ mutex is described as *guarding* the data it holds via the locking system.
Mutexes have a reputation for being difficult to use because you have to
remember two rules:

1. You must attempt to acquire the lock before using the data.
1. When you’re done with the data that the mutex guards, you must unlock the
data so other threads can acquire the lock.

Unmatched: ListNumber0

Unmatched: ListNumber0
For a real-world metaphor for a mutex, imagine a panel discussion at a
For a real-world metaphor for a mutex, imagine a panel discussion at a
conference with only one microphone. Before a panelist can speak, they have to
ask or signal that they want to use the microphone. When they get the
microphone, they can talk for as long as they want to and then hand the
Expand Down
1 change: 1 addition & 0 deletions nostarch/chapter17.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ The final functionality will look like this:
1. When the post is approved, it gets published.
1. Only published blog posts return content to print, so unapproved posts can’t
accidentally be published.

Any other changes attempted on a post should have no effect. For example, if we
try to approve a draft blog post before we’ve requested a review, the post
should remain an unpublished draft.
Expand Down
2 changes: 2 additions & 0 deletions nostarch/chapter19.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ include the ability to:
1. Access or modify a mutable static variable
1. Implement an unsafe trait
1. Access fields of `union`s

It’s important to understand that `unsafe` doesn’t turn off the borrow checker
or disable any of Rust’s other safety checks: if you use a reference in unsafe
code, it will still be checked. The `unsafe` keyword only gives you access to
Expand Down Expand Up @@ -783,6 +784,7 @@ You’ll use default type parameters in two main ways:
1. To extend a type without breaking existing code
1. To allow customization in specific cases most users won’t need
The standard library’s `Add` trait is an example of the second purpose:
usually, you’ll add two like types, but the `Add` trait provides the ability to
customize beyond that. Using a default type parameter in the `Add` trait
Expand Down
3 changes: 3 additions & 0 deletions nostarch/chapter20.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Here is our plan for building the web server:
1. Parse a small number of HTTP requests.
1. Create a proper HTTP response.
1. Improve the throughput of our server with a thread pool.

Before we get started, we should mention one detail: the method we’ll use won’t
be the best way to build a web server with Rust. Community members have
published a number of production-ready crates available at *https://crates.io*
Expand Down Expand Up @@ -1157,6 +1158,7 @@ set up in this way:
closure.
1. In `ThreadPool::new`, use the `for` loop counter to generate an `id`, create
a new `Worker` with that `id`, and store the `Worker` in the vector.

If you’re up for a challenge, try implementing these changes on your own before
looking at the code in Listing 20-15.

Expand Down Expand Up @@ -1250,6 +1252,7 @@ down the channel.
sender.
1. In its thread, the `Worker` will loop over its receiver and execute the
closures of any jobs it receives.

Let’s start by creating a channel in `ThreadPool::new` and holding the sender
in the `ThreadPool` instance, as shown in Listing 20-16. The `Job` struct
doesn’t hold anything for now but will be the type of item we’re sending down
Expand Down
5 changes: 4 additions & 1 deletion tools/docx-to-md.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@
<xsl:text>&#10;&#10;</xsl:text>
</xsl:template>

<xsl:template match="w:p[w:pPr/w:pStyle[@w:val = 'NumListA' or @w:val = 'NumListB' or @w:val = 'ListNumber']]">
<xsl:template match="w:p[w:pPr/w:pStyle[@w:val = 'NumListA' or @w:val = 'NumListB' or @w:val = 'ListNumber' or @w:val = 'ListNumber0']]">
<xsl:text>1. </xsl:text>
<xsl:apply-templates select="*" />
<xsl:text>&#10;</xsl:text>
<xsl:if test="not(following-sibling::*[1][self::w:p]) or following-sibling::w:p[1][w:pPr/w:pStyle[@w:val != 'NumListA' and @w:val != 'NumListB' and @w:val != 'ListNumber' and @w:val != 'ListNumber0']]">
<xsl:text>&#10;</xsl:text>
</xsl:if>
</xsl:template>

<xsl:template match="w:p[w:pPr/w:pStyle[@w:val = 'NumListC']]">
Expand Down

0 comments on commit e593d2a

Please sign in to comment.