- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 104字
- 2021-07-02 23:07:19
Passing values around
Up to this point, we have kept everything within a single method. For small demonstrations (or for method testing), this is fine. However, for larger applications, passing values between methods is essential.
Rust has two main ways to pass information to other methods: by reference or by value. Passing by reference usually implies borrowing, which means that ownership is only temporarily given and can be used again after the function call. Passing by value implies either a permanent ownership change, which means that the caller of a function can no longer access the value, or it might imply copying the data.
推薦閱讀
- Reporting with Visual Studio and Crystal Reports
- CentOS 7 Server Deployment Cookbook
- 深入淺出Spring Boot 2.x
- Visual Basic程序設計教程
- C語言程序設計實訓教程
- Java程序設計與計算思維
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- Android Native Development Kit Cookbook
- SQL Server 2016數據庫應用與開發
- Node.js全程實例
- Getting Started with Gulp
- SQL基礎教程(第2版)
- R語言與網絡輿情處理
- RealSenseTM互動開發實戰
- Python開發基礎