Adjust margins for paperback version. Ensure nothing breaches the right margin.

This commit is contained in:
LukeMathWalker 2024-08-07 15:39:35 +02:00
parent 05e3efd298
commit f9a1d427b2
8 changed files with 19 additions and 15 deletions

View File

@ -61,7 +61,7 @@ monofontfallback = [
urlstyle = "rm" urlstyle = "rm"
documentclass = "book" documentclass = "book"
fontsize = "11pt" 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 = [ header-includes = [
# Reduce font size of code blocks # Reduce font size of code blocks
"\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}", "\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}",

View File

@ -34,8 +34,8 @@ also find solutions to all exercises in the
## Formats ## Formats
You can browse the course material in the browser, at [rust-exercises.com/100-exercises/](https://rust-exercises.com/100-exercises/).\ You can go through the course material [in the browser](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 also [download it as a PDF file](https://rust-exercises.com/100-exercises-to-learn-rust.pdf), for offline reading.
## Structure ## 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 # If you have an SSH key set up with GitHub
git clone git@github.com:mainmatter/100-exercises-to-learn-rust.git git clone git@github.com:mainmatter/100-exercises-to-learn-rust.git
# Otherwise, use the HTTPS URL: # Otherwise, use the HTTPS URL:
# # https://github.com/mainmatter/100-exercises-to-learn-rust.git
# git clone 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 We also recommend you work on a branch, so you can easily track your progress and pull

View File

@ -32,7 +32,7 @@ The function's body is enclosed in curly braces `{}`.
In previous exercise, you saw the `greeting` function: In previous exercise, you saw the `greeting` function:
```rust ```rust
// `fn` <function_name> ( <input parameters> ) -> <return_type> { <body> } // `fn` <function_name> ( <input params> ) -> <return_type> { <body> }
fn greeting() -> &'static str { fn greeting() -> &'static str {
// TODO: fix me 👇 // TODO: fix me 👇
"I'm ready to __!" "I'm ready to __!"

View File

@ -97,8 +97,8 @@ Ownership can be transferred.
If you own a value, for example, you can transfer ownership to another variable: If you own a value, for example, you can transfer ownership to another variable:
```rust ```rust
let a = "hello, world".to_string(); // <--- `a` is 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 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 Rust's ownership system is baked into the type system: each function has to declare in its signature

View File

@ -89,7 +89,8 @@ although a bit more cumbersome to read:
impl ::core::cmp::PartialEq for Ticket { impl ::core::cmp::PartialEq for Ticket {
#[inline] #[inline]
fn eq(&self, other: &Ticket) -> bool { 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 && self.status == other.status
} }
} }

View File

@ -99,7 +99,8 @@ error[E0599]: no method named `is_even` found for type parameter `T`
--> src/lib.rs:2:10 --> src/lib.rs:2:10
| |
1 | fn print_if_even<T>(n: T) { 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() { 2 | if n.is_even() {
| ^^^^^^^ method not found in `T` | ^^^^^^^ method not found in `T`

View File

@ -111,7 +111,8 @@ fn main() {
The compiler is not happy with this code: The compiler is not happy with this code:
```text ```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 --> src/main.rs:10:7
| |
10 | spawn(move || { 10 | spawn(move || {
@ -122,9 +123,10 @@ error[E0277]: `MutexGuard<'_, i32>` cannot be sent between threads safely
12 | | }); 12 | | });
| |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely | |_^ `MutexGuard<'_, i32>` cannot be sent between threads safely
| |
= help: the trait `Send` is not implemented for `MutexGuard<'_, i32>`, = help: the trait `Send` is not implemented for
which is required by `{closure@src/main.rs:10:7: 10:14}: Send` `MutexGuard<'_, i32>`, which is required by
= note: required for `std::sync::mpsc::Receiver<MutexGuard<'_, i32>>` `{closure@src/main.rs:10:7: 10:14}: Send`
= note: required for `Receiver<MutexGuard<'_, i32>>`
to implement `Send` to implement `Send`
note: required because it's used within this closure note: required because it's used within this closure
``` ```

View File

@ -47,7 +47,8 @@ The compiler will reject this code:
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
| |
5 | tokio::spawn(example()); 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 note: future is not `Send` as this value is used across an await
| |