- 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.
推薦閱讀
- Java語言程序設計
- Android Jetpack開發:原理解析與應用實戰
- Python機器學習:數據分析與評分卡建模(微課版)
- Software Testing using Visual Studio 2012
- Programming ArcGIS 10.1 with Python Cookbook
- Spring實戰(第5版)
- Python機器學習算法與實戰
- 深入淺出PostgreSQL
- Kotlin從基礎到實戰
- Lighttpd源碼分析
- Procedural Content Generation for C++ Game Development
- Python程序設計與算法基礎教程(第2版)(微課版)
- 平面設計經典案例教程:CorelDRAW X6
- Bootstrap for Rails
- Kotlin Programming By Example