Adjust margins for paperback version. Ensure nothing breaches the right margin.
This commit is contained in:
parent
05e3efd298
commit
f9a1d427b2
|
@ -61,7 +61,7 @@ monofontfallback = [
|
|||
urlstyle = "rm"
|
||||
documentclass = "book"
|
||||
fontsize = "11pt"
|
||||
geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.4cm,right=2.4cm"
|
||||
geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.8cm,right=2.5cm"
|
||||
header-includes = [
|
||||
# Reduce font size of code blocks
|
||||
"\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}",
|
||||
|
|
|
@ -34,8 +34,8 @@ also find solutions to all exercises in the
|
|||
|
||||
## Formats
|
||||
|
||||
You can browse the course material in the browser, at [rust-exercises.com/100-exercises/](https://rust-exercises.com/100-exercises/).\
|
||||
You can also [download the course material as a PDF file](https://rust-exercises.com/100-exercises-to-learn-rust.pdf), for offline reading.
|
||||
You can go through the course material [in the browser](https://rust-exercises.com/100-exercises/).\
|
||||
You can also [download it as a PDF file](https://rust-exercises.com/100-exercises-to-learn-rust.pdf), for offline reading.
|
||||
|
||||
## Structure
|
||||
|
||||
|
@ -51,8 +51,7 @@ Before starting the course, make sure to clone the repository to your local mach
|
|||
# If you have an SSH key set up with GitHub
|
||||
git clone git@github.com:mainmatter/100-exercises-to-learn-rust.git
|
||||
# Otherwise, use the HTTPS URL:
|
||||
#
|
||||
# git clone https://github.com/mainmatter/100-exercises-to-learn-rust.git
|
||||
# https://github.com/mainmatter/100-exercises-to-learn-rust.git
|
||||
```
|
||||
|
||||
We also recommend you work on a branch, so you can easily track your progress and pull
|
||||
|
|
|
@ -32,7 +32,7 @@ The function's body is enclosed in curly braces `{}`.
|
|||
In previous exercise, you saw the `greeting` function:
|
||||
|
||||
```rust
|
||||
// `fn` <function_name> ( <input parameters> ) -> <return_type> { <body> }
|
||||
// `fn` <function_name> ( <input params> ) -> <return_type> { <body> }
|
||||
fn greeting() -> &'static str {
|
||||
// TODO: fix me 👇
|
||||
"I'm ready to __!"
|
||||
|
|
|
@ -97,8 +97,8 @@ Ownership can be transferred.
|
|||
If you own a value, for example, you can transfer ownership to another variable:
|
||||
|
||||
```rust
|
||||
let a = "hello, world".to_string(); // <--- `a` is the owner of the String
|
||||
let b = a; // <--- `b` is now the owner of the String
|
||||
let a = "hello, world".to_string(); // <- `a` is the owner of the String
|
||||
let b = a; // <- `b` is now the owner of the String
|
||||
```
|
||||
|
||||
Rust's ownership system is baked into the type system: each function has to declare in its signature
|
||||
|
|
|
@ -89,7 +89,8 @@ although a bit more cumbersome to read:
|
|||
impl ::core::cmp::PartialEq for Ticket {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Ticket) -> bool {
|
||||
self.title == other.title && self.description == other.description
|
||||
self.title == other.title
|
||||
&& self.description == other.description
|
||||
&& self.status == other.status
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,8 @@ error[E0599]: no method named `is_even` found for type parameter `T`
|
|||
--> src/lib.rs:2:10
|
||||
|
|
||||
1 | fn print_if_even<T>(n: T) {
|
||||
| - method `is_even` not found for this type parameter
|
||||
| - method `is_even` not found
|
||||
| for this type parameter
|
||||
2 | if n.is_even() {
|
||||
| ^^^^^^^ method not found in `T`
|
||||
|
||||
|
|
|
@ -111,7 +111,8 @@ fn main() {
|
|||
The compiler is not happy with this code:
|
||||
|
||||
```text
|
||||
error[E0277]: `MutexGuard<'_, i32>` cannot be sent between threads safely
|
||||
error[E0277]: `MutexGuard<'_, i32>` cannot be sent between
|
||||
threads safely
|
||||
--> src/main.rs:10:7
|
||||
|
|
||||
10 | spawn(move || {
|
||||
|
@ -122,9 +123,10 @@ error[E0277]: `MutexGuard<'_, i32>` cannot be sent between threads safely
|
|||
12 | | });
|
||||
| |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely
|
||||
|
|
||||
= help: the trait `Send` is not implemented for `MutexGuard<'_, i32>`,
|
||||
which is required by `{closure@src/main.rs:10:7: 10:14}: Send`
|
||||
= note: required for `std::sync::mpsc::Receiver<MutexGuard<'_, i32>>`
|
||||
= help: the trait `Send` is not implemented for
|
||||
`MutexGuard<'_, i32>`, which is required by
|
||||
`{closure@src/main.rs:10:7: 10:14}: Send`
|
||||
= note: required for `Receiver<MutexGuard<'_, i32>>`
|
||||
to implement `Send`
|
||||
note: required because it's used within this closure
|
||||
```
|
||||
|
|
|
@ -47,7 +47,8 @@ The compiler will reject this code:
|
|||
error: future cannot be sent between threads safely
|
||||
|
|
||||
5 | tokio::spawn(example());
|
||||
| ^^^^^^^^^ future returned by `example` is not `Send`
|
||||
| ^^^^^^^^^
|
||||
| future returned by `example` is not `Send`
|
||||
|
|
||||
note: future is not `Send` as this value is used across an await
|
||||
|
|
||||
|
|
Loading…
Reference in New Issue