Topic | Description | Link |
---|---|---|
Generics | Generics in Rust are very similar to those in C# and Java, and simpler than C++ templates. They are code generators often do little more than substitute a specific type for a generic parameter. Rust generics are often constrained with traits, as discussed above. |
Rust Story Generics Rust Bites Generics and Traits The Rust Book |
Ownership | Rusts ownership rules: There is only one owner for any resource. Owners deallocate their resources when they go out of scope. Ownership can be transferred with a Move or borrowed with a reference. References don't own resources, they just borrow them, and so never deallocate. Rust ownership does not support simultaneously aliasing and mutation. |
Rust Bites Ownership Rust Story Ownership By Example Rust Book Rust Nomicon |
Strings |
Rust std strings come in two flavors: |
std::String std::str std::path std::path::PathBuf std::path::Path Rust by Example |
struct | Rust structs serve the same role as classes do in C++ and C#. Struct methods are defined inside impl StructName {} blocks. |
Rust Story structs std::Stuct keyword impl |
File System |
Rust has a well engineered facility for accessing files and directories. Some key types in std::fs are: DirEntry, File, OpenOptions, ReadDir, ... |
Rust story File System std::fs |