Compare commits

...

9 Commits

Author SHA1 Message Date
Henk Oordt
9e63a5cdf6 Merge pull request #190 from Manubi/patch-1 2024-10-29 15:48:35 +01:00
Manuel Bichler
f4a7472f30 Update 08_overflow.md
Added some context.
2024-10-29 15:40:56 +01:00
Henk Oordt
04b89ff26e Merge pull request #188 from cenviity/push-usrtukunqysw
exercises 02_basic_calculator/04_panics: fix comma splice in panic message
2024-10-29 14:39:03 +01:00
Henk Oordt
26e78072cd Merge pull request #187 from half2me/patch-1
Fix docstring: "when converted to `u8`"
2024-10-29 14:30:20 +01:00
Henk Oordt
c540242c15 Merge pull request #172 from marcoow/fix-fork-build
Fix builds for PRs originating from forks
2024-10-29 14:16:29 +01:00
Manuel Bichler
f14a047e8b Update 08_overflow.md
if you read threw the profile docs it provides 4 profiles. https://doc.rust-lang.org/cargo/reference/profiles.html
2024-10-27 19:32:58 +01:00
Vincent Ging Ho Yim
5e23bee61e exercises 02_basic_calculator/04_panics: fix comma splice in panic message 2024-10-24 15:18:53 +11:00
Benjamin Tamasi
8488317564 Change docstring: "when converted to u8"
Fixed docstring
2024-10-22 13:39:17 +02:00
Marco Otte-Witte
4ca49fa5fd use OpenSans as fallback font on PRs from forks 2024-10-14 12:56:17 +02:00
5 changed files with 29 additions and 13 deletions

View File

@@ -19,17 +19,27 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: Get Core Sans
uses: actions/checkout@v4
if: "!github.event.pull_request.head.repo.fork"
with:
fetch-depth: 0
repository: mainmatter/core-sans-a-fonts
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
path: core-sans-a-fonts
- name: Install Fonts
- name: Install Core Sans Font
if: "!github.event.pull_request.head.repo.fork"
run: |
sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/
sudo fc-cache -f -v
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
- name: Install exercise plugin
run: cargo install --path helpers/mdbook-exercise-linker
@@ -39,8 +49,8 @@ jobs:
run: |
cargo install mdbook-pandoc --locked --version 0.7.1
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
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

View File

@@ -49,8 +49,8 @@ sansfontoptions = [
]
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
monofont = "Noto Sans Mono"
mainfontfallback = ["Noto Color Emoji:mode=harf"]
sansfontfallback = ["Noto Color Emoji:mode=harf"]
mainfontfallback = ["Open Sans"]
sansfontfallback = ["Open Sans"]
monofontfallback = [
"Noto Color Emoji:mode=harf",
]
@@ -90,8 +90,8 @@ sansfontoptions = [
]
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
monofont = "Noto Sans Mono"
mainfontfallback = ["Noto Color Emoji:mode=harf"]
sansfontfallback = ["Noto Color Emoji:mode=harf"]
mainfontfallback = ["Open Sans"]
sansfontfallback = ["Open Sans"]
monofontfallback = [
"Noto Color Emoji:mode=harf",
]
@@ -121,8 +121,8 @@ metadata-file = "metadata.yml"
[output.pandoc.profile.html.variables]
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
monofont = "Noto Sans Mono"
mainfontfallback = ["Noto Color Emoji:mode=harf"]
sansfontfallback = ["Noto Color Emoji:mode=harf"]
mainfontfallback = ["Open Sans"]
sansfontfallback = ["Open Sans"]
monofontfallback = [
"Noto Color Emoji:mode=harf",
]

View File

@@ -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
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
development,
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
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.\
> It refers to developers who are not familiar with Rust and complain about its performance on

View File

@@ -19,7 +19,7 @@ mod tests {
// 👇 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`.
// 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() {
speed(0, 10, 0);
}

View File

@@ -23,7 +23,7 @@ mod tests {
// 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
// `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!();
assert_eq!(x, y);