chore: initialize containerized Rust learning workbook
This commit is contained in:
commit
05ffbd18bf
23 files changed
+549
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# 05 — Generyki, Traity i Lifetimes
|
||||
|
||||
## Zakres
|
||||
* Funkcje i typy generyczne (`<T: PartialOrd>`)
|
||||
* Definiowanie i implementowanie traitów (`trait Summary`)
|
||||
* Podstawowe adnotacje czasu życia (`'a`)
|
||||
|
||||
## Zadania (`src/lib.rs`)
|
||||
1. `largest<T: PartialOrd>(items: &[T]) -> Option<&T>` — zwróć referencję do największego elementu w wycinku (lub `None` dla pustego wycinka).
|
||||
2. Zaimplementuj trait `Summary` dla struktury `Article`.
|
||||
3. `longest<'a>(x: &'a str, y: &'a str) -> &'a str` — zwróć dłuższy z dwóch napisów (gdy równe, zwróć `x`).
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=ex05-generics-traits
|
||||
```
|
||||
Reference in new issue
Block a user