RUST EĞİTİMİ
Rust eğitimi, dilin "compiler düşmanım" hissini güvenlik garantilerine dönüştürmek isteyen mühendisleri yetiştirir. Ownership ve borrow checker sezgisel anlatılır; lifetime ('a) ile referans güvenliği doğru ifade edilir; Result ve Option ile exception'sız hata yönetimi somut örneklerle işlenir.
Program sonunda katılımcı, trait ile generic ve dyn dispatch arasında karar verir; async/await ve tokio ile asenkron programlama kurar; Cargo ile dependency, workspace ve feature flag yönetir. unsafe Rust ile FFI ve C/C++ interop eğitimin advanced kapanışıdır. Eğitim, The Rust Programming Language kitabı baz alınarak kurgulanır.
Katılımcı Profili
Bu eğitim, Rust'ın "compiler düşmanım" hissinden çıkartıp dilin güvenlik garantilerini avantaja çevirmek isteyen rollere yöneliktir:
- Sistem Programcıları: Bellek güvenli ve hızlı kod yazan mühendisler
- Backend Mühendisleri: Yüksek performans hedefiyle Rust kullanan roller
- Gömülü Geliştiriciler: no_std ile bare metal yazan ekipler
- C/C++ Geliştiriciler: Bellek güvenli alternatif arayan mühendisler
- WebAssembly Geliştiricileri: Wasm hedefiyle Rust kullanan ekipler
Ön Gereklilikler
Bu eğitime katılım için aşağıdaki ön bilgiler önerilir:
- C, C++ veya başka bir sistem dilinde geliştirme deneyimi (tercihen)
- Pointer, referans ve memory model kavramlarına aşinalık
- OOP veya fonksiyonel programlama yaklaşımına giriş düzeyi bilgi
- Komut satırı (cargo) ile rahat çalışma
- Git ile sürüm kontrol akışı bilgisi
Süresi ve Tarihi
Süre: 4 gün. Bu süre standart program içindir; ek modüllere ve hedefe göre süre özelleştirilebilir.
Eğitim tarihleri ve saatleri, ekibinizin uygunluğuna göre birlikte planlanır.
Kazanımlar
Bu eğitim sonunda katılımcı, Rust'ın "compiler düşmanım" hissinden çıkıp dilin güvenlik garantilerini avantaja çevirir:
- Ownership ve borrow checker'ı sezgisel açıklar
- Lifetime ('a) ile referans güvenliğini doğru ifade eder
- Result ve Option ile exception'sız hata yönetimi yapar
- Trait ile generic ve dyn dispatch arasında karar verir
- async/await ve tokio ile asenkron programlama kurar
- Cargo ile dependency, workspace ve feature flag yönetir
- unsafe Rust ile FFI; C/C++ ile interop tasarlar
Rust Eğitimi Konuları
1. Rust Felsefesi - Safety, Speed, Concurrency
- Sıfır maliyetli soyutlamalar
- Memory safety: GC olmadan
- Edition modeli (2015, 2018, 2021, 2024)
- rustup, cargo, rustc
2. Cargo - Build ve Paket Yöneticisi
- Cargo.toml ve Cargo.lock
- crates.io ve docs.rs
- Workspace ile multi-crate
- Profile: dev, release
- cargo run, build, test, doc, clippy, fmt
3. Ownership ve Move Semantics
- Her değerin tek bir owner'ı vardır
- Move vs copy
- Scope ve drop
- String vs &str
4. Borrowing ve Reference
- Immutable reference (&T)
- Mutable reference (&mut T)
- Borrowing kuralları
- Dangling reference önleme
- NLL (Non-Lexical Lifetimes)
5. Lifetime
- Lifetime annotation ('a)
- Lifetime elision rule
- Static lifetime ('static)
- Struct ve method lifetime
6. Struct, Enum, Pattern Matching
- Struct: named, tuple, unit
- Enum ve algebraic data type
- match expression ve exhaustiveness
- if let ve while let
- Destructuring
7. Trait ve Generic
- Trait tanımı ve impl Trait for Type
- Default method
- Trait bound ve where clause
- Generic function ve struct
- Dynamic dispatch (dyn Trait)
8. Error Handling - Result, Option
- Option<T>: Some, None
- Result<T, E>: Ok, Err
- ? operator ile propagation
- thiserror ve anyhow crate
- panic! ve unrecoverable error
9. Smart Pointer - Box, Rc, Arc, RefCell
- Box<T> ile heap allocation
- Rc<T> reference counting (single-thread)
- Arc<T> atomic reference counting
- RefCell<T> interior mutability
- Mutex<T> ve RwLock<T>
10. Closure ve Iterator
- Fn, FnMut, FnOnce trait
- move closure
- Iterator trait ve adaptor
- Zero-cost iterator
- collect, filter, map, fold
11. Collection - Vec, HashMap, BTreeMap
- Vec<T> dynamic array
- HashMap<K, V>
- BTreeMap ve sorted map
- VecDeque ve LinkedList
- String ve OsString
12. Concurrency - Thread ve Channel
- std::thread::spawn
- mpsc channel ile message passing
- Send ve Sync marker trait
- Crossbeam ve rayon crate
- Data race önleme
13. Async/Await - Tokio
- async fn ve Future trait
- .await operatörü
- Tokio runtime
- tokio::spawn ve task
- async ekosistem: hyper, reqwest
14. Macro - Declarative ve Procedural
- macro_rules! ile declarative macro
- Procedural macro: derive, attribute
- quote ve syn crate
- println!, vec!, format! örnekleri
15. Unsafe Rust ve FFI
- unsafe block ve raw pointer
- extern "C" ile FFI
- bindgen ile C binding
- cbindgen ile C header üretme
- Soundness ve invariant
16. Testing ve Documentation
- #[test] ve cargo test
- Integration test (tests/ klasörü)
- Doc-test ile örnek doğrulama
- Property-based test: proptest
- Benchmark: criterion
17. Web Framework - Axum, Actix-web
- Axum ile Tokio uyumlu API
- Actix-web ve aktör model
- Rocket ve Warp alternatif
- SQLx ve Diesel ORM
- Serde ile serialization
18. Embedded ve no_std
- no_std ile bare metal
- embedded-hal ile donanım soyutlama
- Cortex-M, ESP32, RP2040 desteği
- Probe-rs ile flashing ve debugging
RUST EĞİTİMİ ile İlgili
Sıkça Sorulan Sorular ve Cevapları
Ownership ile borrowing arasında temel mantık nedir?
Her değerin tek bir owner'ı vardır; scope sonunda drop edilir. Borrowing reference verir — &T immutable, &mut T mutable. Aynı anda birden fazla immutable veya tek mutable reference olabilir, ikisi karışmaz. Bu kurallar derleme zamanında uygulanır — runtime overhead yok, data race önlenir.
Lifetime annotation ne zaman gerekli?
Compiler lifetime'ı çoğu zaman çıkarımlar (elision rules). Struct field'ı reference içeriyorsa veya fonksiyon birden çok reference parametresi alıp reference dönüyorsa 'a annotation şart. 'static lifetime tüm program ömrü; literal string'ler ve const otomatik 'static.
Result ve Option ile hata yönetimi try/catch'e göre nasıl?
Rust exception yerine Result
Box, Rc, Arc ve RefCell ne zaman hangisi kullanılır?
Box heap allocation, single owner. Rc reference counting, multi-owner single-thread. Arc atomic reference counting, multi-thread. RefCell interior mutability runtime borrow check ile — immutable reference içinde mutate. Mutex thread-safe mutable. Karar: thread sayısı, ownership ve mutability ihtiyacı.
Async/await ve tokio ne zaman gerekli?
I/O-bound concurrent iş için async/await — bin/onbinlerce simultan connection tek thread'de yönetilir. tokio en yaygın async runtime; reqwest, axum gibi ekosistem üzerinde duruyor. CPU-bound iş için thread pool veya rayon. async overhead küçük scriptlerde gereksiz; ölçek gerekiyor.
unsafe Rust ne zaman doğru, ne zaman riskli?
FFI (C kütüphanesi çağırma), low-level memory manipulation, performance-kritik operasyonlar için unsafe bloğu gerekli. Compiler güvenlik garantilerini bu bloğa girmediğini varsayar. unsafe minimum tutulmalı, sound abstraction içinde sarmalanmalı. Çoğu uygulama kodu hiç unsafe içermez.



