- 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.
推薦閱讀
- DevOps:軟件架構師行動指南
- C語言程序設計案例教程(第2版)
- 程序員面試筆試寶典
- Java應用開發與實踐
- OpenNI Cookbook
- 深入理解Java7:核心技術與最佳實踐
- Learning Firefox OS Application Development
- The DevOps 2.4 Toolkit
- Learning OpenCV 3 Computer Vision with Python(Second Edition)
- Emgu CV Essentials
- Scala編程(第5版)
- Mastering HTML5 Forms
- C++ System Programming Cookbook
- 視窗軟件設計和開發自動化:可視化D++語言
- C Primer Plus(第6版)中文版【最新修訂版】