অধ্যায় 10
Generic Type, Trait, এবং Lifetime
Generic Types, Traits, and Lifetimes
কোনো logic একই — শুধু type আলাদা — এই duplication এড়ানোর জন্য generic। সেই generic-এ কী কী operation allowed সেটা বলার জন্য trait। আর reference-গুলো কতদূর valid সেটা compile time-এ verify করার জন্য lifetime।
এই তিনটা feature Rust-এর type system-এর মেরুদণ্ড। ownership-এর চেয়েও দ্বিতীয় বড় mental shift। তিন পাঠে এক এক করে দেখব। শেষে এদের একসাথে ব্যবহার।