35 lines
1.0 KiB
Markdown
35 lines
1.0 KiB
Markdown
# Rust Weekend - April 27-28, 2024
|
||
|
||
## My Notes
|
||
|
||
There are code-based notes in the file `src/main.rs`. I recommend tinkering with it, like commenting/uncommenting portions, reading compiler errors, and looking at the types in your IDE.
|
||
|
||
Plain text notes are below.
|
||
|
||
```text
|
||
cargo init -> existing dir
|
||
cargo new -> new subdir
|
||
|
||
compiler doesn't check against infinite loops
|
||
|
||
access modifiers:
|
||
- private (default)
|
||
- pub
|
||
- pub(crate)
|
||
|
||
Ownership kuralları:
|
||
- Bir şeyin sadece bir sahibi olur
|
||
- Bir şeyin birim zamanda tek sahibi olur
|
||
- Bir şey gerekli olmadığında drop edilir
|
||
Bunun 3 uygulanış biçimi vardır:
|
||
- Copy (veri transferi, fixed size)
|
||
- Move (move semantic/ownership transfer, non-fixed size)
|
||
- Clone (birebir aynısını oluşturma, non-fixed size)
|
||
|
||
Borrowing için & operatörü kullanılır. 2 çeşidi vardır:
|
||
- Immutable borrowing/shared reference (1:N, sanat galerisi/ziyaretçi ilişkisi)
|
||
- Mutable borrowing (1:1, kiracı/ev sahibi ilişkisi)
|
||
|
||
rust'ta method overloading (aynı isim farklı parametre) yok
|
||
```
|