Skip to content

Commit 7080090

Browse files
committed
Initial commit
0 parents  commit 7080090

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5623
-0
lines changed

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
**/target/
4+
5+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
6+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
7+
Cargo.lock
8+
9+
# These are backup files generated by rustfmt
10+
**/*.rs.bk
11+
12+
# Were the pdfs will be
13+
/out/
14+
15+
# compiled
16+
test/lesson3_3_ref
17+
test/lesson5_destr_enum
18+
19+
# ViM temp files
20+
*.swp
21+
*.swo

Makefile

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
OUTDIR := out
2+
SRCDIR := src
3+
SRCS := $(wildcard src/lesson*.typ)
4+
# ∀%: src/lesson%.typ ⇒ out/lesson%.pdf
5+
OUTS := $(foreach lesson,$(SRCS:.typ=.pdf),$(subst $(SRCDIR)/,$(OUTDIR)/,$(lesson)))
6+
SLIDES = $(SRCDIR)/slides.typ
7+
SYNCDIR := ./
8+
REMOTE := kaki:public_html/rust-lessons
9+
# verbose, checksum, Progress
10+
RSYNCFLAGS := -vcP --exclude-from=rsync_exclude
11+
# tell typst where to look for fonts, equivalent to « --font-path fonts/ »
12+
TYPST_FONT_PATHS := fonts/
13+
14+
# tell make that these are not supposed to be files
15+
.PHONY: all clean watch% lesson% rsync rsync-dryrun
16+
17+
all: $(OUTS) Makefile
18+
19+
clean:
20+
rm -rf $(OUTDIR)/*.pdf
21+
22+
watch%: $(SRCDIR)/lesson%.typ $(SLIDES) Makefile
23+
TYPST_FONT_PATHS=$(TYPST_FONT_PATHS) \
24+
typst watch $< $(subst $(SRCDIR),$(OUTDIR),$(subst .typ,.pdf,$<))
25+
26+
lesson%: $(OUTDIR)/lesson%.pdf
27+
@true
28+
29+
# tell make that these files have no dependency
30+
$(SRCDIR)/lesson%.typ:
31+
@true
32+
33+
$(OUTDIR)/lesson%.pdf: $(SRCDIR)/lesson%.typ $(SLIDES) Makefile
34+
TYPST_FONT_PATHS=$(TYPST_FONT_PATHS) \
35+
typst compile $< $@
36+
37+
rsync:
38+
rsync -r $(RSYNCFLAGS) $(SYNCDIR) $(REMOTE)/
39+
40+
rsync-dryrun:
41+
rsync -rn $(RSYNCFLAGS) $(SYNCDIR) $(REMOTE)/

README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Rust Lessons
2+
3+
## Compiling to pdf
4+
You need the [typst] typesetting system.
5+
6+
To compile a specific lesson:
7+
```shell
8+
make lesson$number
9+
make lesson1
10+
```
11+
To compile all lessons:
12+
```shell
13+
make all -j $(nproc)
14+
```
15+
16+
## Lesson notes
17+
How a specific lesson is planned
18+
19+
### Lesson 1
20+
- 30 minutes installation of the toolchain
21+
- 60 minutes for the basics
22+
If someone does **not** have a working setup after 15 minutes,
23+
instruct them to use the computer in front of them (assuming you are in the computer pools).
24+
25+
End with everyone trying out exercise 1
26+
27+
### Lesson 2
28+
#### Funktionen
29+
Explain what functions look like.
30+
Order independent:
31+
`seven()` is defined after its first use in the file.
32+
Ask: Can anybody see an error?
33+
-> use meaningful variable names
34+
35+
#### statements und expressions
36+
- backtrack to tuple -> empty tuple -> unit type
37+
38+
#### Quiz 3 Fibonacci
39+
-> overflow checks
40+
- End: give many different input parameters without explicitly saying so
41+
-> loop
42+
43+
#### loops
44+
- `loop` `continue`, `break`
45+
- with `if` + `else` we can exit loop
46+
47+
- `while`: condition tied to loop
48+
49+
50+
51+
[typst]: https://github.com/typst/typst

0 commit comments

Comments
 (0)