Render the book in PDF using pandoc and LaTeX. (#126)
* Render the book in PDF using `pandoc` and LaTeX. * Fix installs. * Go the apt-get route * Another attempt * Avoid installing twice. * Re-order. * Add more packages. * Minimise deps. Fix link checker. * Missing package. * Missing package. * Missing package. * More packages. * Missing package. * Missing package. * More packages... * Remove. * Fix link checker. * Fix link checker. * Fix path. * Add subtitle. * Avoid running over the right margin. * Avoid running over the right margin. * Formatting
This commit is contained in:
@@ -94,7 +94,8 @@ fn print_if_even<T>(n: T) {
|
||||
This code won't compile:
|
||||
|
||||
```text
|
||||
error[E0599]: no method named `is_even` found for type parameter `T` in the current scope
|
||||
error[E0599]: no method named `is_even` found for type parameter `T`
|
||||
in the current scope
|
||||
--> src/lib.rs:2:10
|
||||
|
|
||||
1 | fn print_if_even<T>(n: T) {
|
||||
@@ -106,7 +107,9 @@ error[E0277]: `T` doesn't implement `Debug`
|
||||
--> src/lib.rs:3:19
|
||||
|
|
||||
3 | println!("{n:?} is even");
|
||||
| ^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^
|
||||
| `T` cannot be formatted using `{:?}` because
|
||||
| it doesn't implement `Debug`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
|
||||
@@ -72,7 +72,8 @@ You can, for example, create a `&str` from a `String` like this:
|
||||
```rust
|
||||
let mut s = String::with_capacity(5);
|
||||
s.push_str("Hello");
|
||||
// Create a string slice reference from the `String`, skipping the first byte.
|
||||
// Create a string slice reference from the `String`,
|
||||
// skipping the first byte.
|
||||
let slice: &str = &s[1..];
|
||||
```
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ to the pointer: the length of the slice it points to. Going back to the example
|
||||
```rust
|
||||
let mut s = String::with_capacity(5);
|
||||
s.push_str("Hello");
|
||||
// Create a string slice reference from the `String`, skipping the first byte.
|
||||
// Create a string slice reference from the `String`,
|
||||
// skipping the first byte.
|
||||
let slice: &str = &s[1..];
|
||||
```
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
Let's go back to where our string journey started:
|
||||
|
||||
```rust
|
||||
let ticket = Ticket::new("A title".into(), "A description".into(), "To-Do".into());
|
||||
let ticket = Ticket::new(
|
||||
"A title".into(),
|
||||
"A description".into(),
|
||||
"To-Do".into()
|
||||
);
|
||||
```
|
||||
|
||||
We now know enough to start unpacking what `.into()` is doing here.
|
||||
@@ -14,7 +18,11 @@ This is the signature of the `new` method:
|
||||
|
||||
```rust
|
||||
impl Ticket {
|
||||
pub fn new(title: String, description: String, status: String) -> Self {
|
||||
pub fn new(
|
||||
title: String,
|
||||
description: String,
|
||||
status: String
|
||||
) -> Self {
|
||||
// [...]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ impl Drop for MyType {
|
||||
The compiler will complain with this error message:
|
||||
|
||||
```text
|
||||
error[E0184]: the trait `Copy` cannot be implemented for this type; the type has a destructor
|
||||
error[E0184]: the trait `Copy` cannot be implemented for this type;
|
||||
the type has a destructor
|
||||
--> src/lib.rs:2:17
|
||||
|
|
||||
2 | #[derive(Clone, Copy)]
|
||||
|
||||
Reference in New Issue
Block a user