Compare commits
9 Commits
12fb62d8be
...
9e63a5cdf6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e63a5cdf6 | ||
|
|
f4a7472f30 | ||
|
|
04b89ff26e | ||
|
|
26e78072cd | ||
|
|
c540242c15 | ||
|
|
f14a047e8b | ||
|
|
5e23bee61e | ||
|
|
8488317564 | ||
|
|
4ca49fa5fd |
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@@ -19,17 +19,27 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/checkout@v4
|
- name: Get Core Sans
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
if: "!github.event.pull_request.head.repo.fork"
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
repository: mainmatter/core-sans-a-fonts
|
repository: mainmatter/core-sans-a-fonts
|
||||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
path: core-sans-a-fonts
|
path: core-sans-a-fonts
|
||||||
- name: Install Fonts
|
- name: Install Core Sans Font
|
||||||
|
if: "!github.event.pull_request.head.repo.fork"
|
||||||
run: |
|
run: |
|
||||||
sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/
|
sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/
|
||||||
sudo fc-cache -f -v
|
sudo fc-cache -f -v
|
||||||
fc-list | grep "Core Sans"
|
fc-list | grep "Core Sans"
|
||||||
|
- name: Use Fallback font for fork PRs
|
||||||
|
if: "github.event.pull_request.head.repo.fork"
|
||||||
|
run: |
|
||||||
|
sed -i 's/"BoldFont=CoreSansA65.ttf",//g' book/book.toml
|
||||||
|
sed -i 's/"ItalicFont=CoreSansA45It.ttf",//g' book/book.toml
|
||||||
|
sed -i 's/"BoldItalicFont=CoreSansA65It.ttf",//g' book/book.toml
|
||||||
|
sed -i 's/CoreSansA45.ttf/Open Sans:style=Regular/g' book/book.toml
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- name: Install exercise plugin
|
- name: Install exercise plugin
|
||||||
run: cargo install --path helpers/mdbook-exercise-linker
|
run: cargo install --path helpers/mdbook-exercise-linker
|
||||||
@@ -39,8 +49,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cargo install mdbook-pandoc --locked --version 0.7.1
|
cargo install mdbook-pandoc --locked --version 0.7.1
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y fonts-noto calibre pdftk
|
sudo apt-get install -y fonts-noto fonts-open-sans calibre pdftk
|
||||||
|
sudo fc-cache -f -v
|
||||||
export PANDOC_VERSION=3.3
|
export PANDOC_VERSION=3.3
|
||||||
curl -LsSf https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | tar zxf -
|
curl -LsSf https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | tar zxf -
|
||||||
echo "$PWD/pandoc-${PANDOC_VERSION}/bin" >> $GITHUB_PATH
|
echo "$PWD/pandoc-${PANDOC_VERSION}/bin" >> $GITHUB_PATH
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ sansfontoptions = [
|
|||||||
]
|
]
|
||||||
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
|
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
|
||||||
monofont = "Noto Sans Mono"
|
monofont = "Noto Sans Mono"
|
||||||
mainfontfallback = ["Noto Color Emoji:mode=harf"]
|
mainfontfallback = ["Open Sans"]
|
||||||
sansfontfallback = ["Noto Color Emoji:mode=harf"]
|
sansfontfallback = ["Open Sans"]
|
||||||
monofontfallback = [
|
monofontfallback = [
|
||||||
"Noto Color Emoji:mode=harf",
|
"Noto Color Emoji:mode=harf",
|
||||||
]
|
]
|
||||||
@@ -90,8 +90,8 @@ sansfontoptions = [
|
|||||||
]
|
]
|
||||||
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
|
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
|
||||||
monofont = "Noto Sans Mono"
|
monofont = "Noto Sans Mono"
|
||||||
mainfontfallback = ["Noto Color Emoji:mode=harf"]
|
mainfontfallback = ["Open Sans"]
|
||||||
sansfontfallback = ["Noto Color Emoji:mode=harf"]
|
sansfontfallback = ["Open Sans"]
|
||||||
monofontfallback = [
|
monofontfallback = [
|
||||||
"Noto Color Emoji:mode=harf",
|
"Noto Color Emoji:mode=harf",
|
||||||
]
|
]
|
||||||
@@ -121,8 +121,8 @@ metadata-file = "metadata.yml"
|
|||||||
[output.pandoc.profile.html.variables]
|
[output.pandoc.profile.html.variables]
|
||||||
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
|
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
|
||||||
monofont = "Noto Sans Mono"
|
monofont = "Noto Sans Mono"
|
||||||
mainfontfallback = ["Noto Color Emoji:mode=harf"]
|
mainfontfallback = ["Open Sans"]
|
||||||
sansfontfallback = ["Noto Color Emoji:mode=harf"]
|
sansfontfallback = ["Open Sans"]
|
||||||
monofontfallback = [
|
monofontfallback = [
|
||||||
"Noto Color Emoji:mode=harf",
|
"Noto Color Emoji:mode=harf",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -69,12 +69,18 @@ You may be wondering—what is a profile setting? Let's get into that!
|
|||||||
A [**profile**](https://doc.rust-lang.org/cargo/reference/profiles.html) is a set of configuration options that can be
|
A [**profile**](https://doc.rust-lang.org/cargo/reference/profiles.html) is a set of configuration options that can be
|
||||||
used to customize the way Rust code is compiled.
|
used to customize the way Rust code is compiled.
|
||||||
|
|
||||||
Cargo provides two built-in profiles: `dev` and `release`.\
|
Cargo provides 4 built-in profiles: `dev`, `release`, `test`, and `bench`.\
|
||||||
The `dev` profile is used every time you run `cargo build`, `cargo run` or `cargo test`. It's aimed at local
|
The `dev` profile is used every time you run `cargo build`, `cargo run` or `cargo test`. It's aimed at local
|
||||||
development,
|
development,
|
||||||
therefore it sacrifices runtime performance in favor of faster compilation times and a better debugging experience.\
|
therefore it sacrifices runtime performance in favor of faster compilation times and a better debugging experience.\
|
||||||
The `release` profile, instead, is optimized for runtime performance but incurs longer compilation times. You need
|
The `release` profile, instead, is optimized for runtime performance but incurs longer compilation times. You need
|
||||||
to explicitly request via the `--release` flag—e.g. `cargo build --release` or `cargo run --release`.
|
to explicitly request via the `--release` flag—e.g. `cargo build --release` or `cargo run --release`.
|
||||||
|
The `test` profile is the default profile used by `cargo test`. The `test` profile inherits the settings form the `dev` profile.
|
||||||
|
The `bench` profile is the default profile used by `cargo bench`. The `bench` profile inherits from the `release` profile.
|
||||||
|
Use `dev` for iterative development and debugging, `release` for optimized production builds,\
|
||||||
|
`test` for correctness testing, and `bench` for performance benchmarking.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
> "Have you built your project in release mode?" is almost a meme in the Rust community.\
|
> "Have you built your project in release mode?" is almost a meme in the Rust community.\
|
||||||
> It refers to developers who are not familiar with Rust and complain about its performance on
|
> It refers to developers who are not familiar with Rust and complain about its performance on
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ mod tests {
|
|||||||
// 👇 With the `#[should_panic]` annotation we can assert that we expect the code
|
// 👇 With the `#[should_panic]` annotation we can assert that we expect the code
|
||||||
// under test to panic. We can also check the panic message by using `expected`.
|
// under test to panic. We can also check the panic message by using `expected`.
|
||||||
// This is all part of Rust's built-in test framework!
|
// This is all part of Rust's built-in test framework!
|
||||||
#[should_panic(expected = "The journey took no time at all, that's impossible!")]
|
#[should_panic(expected = "The journey took no time at all. That's impossible!")]
|
||||||
fn by_zero() {
|
fn by_zero() {
|
||||||
speed(0, 10, 0);
|
speed(0, 10, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ mod tests {
|
|||||||
|
|
||||||
// You could solve this by using exactly the same expression as above,
|
// You could solve this by using exactly the same expression as above,
|
||||||
// but that would defeat the purpose of the exercise. Instead, use a genuine
|
// but that would defeat the purpose of the exercise. Instead, use a genuine
|
||||||
// `i8` value that is equivalent to `255` when converted from `u8`.
|
// `i8` value that is equivalent to `255` when converted to `u8`.
|
||||||
let y: i8 = todo!();
|
let y: i8 = todo!();
|
||||||
|
|
||||||
assert_eq!(x, y);
|
assert_eq!(x, y);
|
||||||
|
|||||||
Reference in New Issue
Block a user