- Rust Programming Cookbook
- Claus Matzinger
- 99字
- 2021-06-24 12:27:45
Sharing code among types
An unusual feature of the Rust programming language is the decision to use traits over interfaces. The latter is very common across modern object-oriented languages and unifies the API of a class (or similar) to the caller, making it possible to switch the entire implementation without the caller's knowledge. In Rust, the separation is a bit different: traits are more akin to abstract classes since they provide the API aspect as well as default implementations. struct can implement various traits, thereby offering the same behavior with other structs that implement the same traits.
推薦閱讀
- INSTANT OpenCV Starter
- Dependency Injection in .NET Core 2.0
- Effective Python Penetration Testing
- JavaScript動態網頁開發詳解
- JavaScript 程序設計案例教程
- 圖數據庫實戰
- Android Studio Cookbook
- Node.js從入門到精通
- DB2SQL性能調優秘笈
- SCRATCH編程課:我的游戲我做主
- Effective C++:改善程序與設計的55個具體做法(第三版)中文版(雙色)
- Python趣味創意編程
- 網絡綜合布線與組網實戰指南
- HTML并不簡單:Web前端開發精進秘籍
- HTML5程序開發范例寶典