- 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.
推薦閱讀
- Learning LibGDX Game Development(Second Edition)
- Web應(yīng)用系統(tǒng)開發(fā)實踐(C#)
- 從零構(gòu)建知識圖譜:技術(shù)、方法與案例
- Oracle Exadata性能優(yōu)化
- PHP 從入門到項目實踐(超值版)
- Magento 2 Theme Design(Second Edition)
- Python Deep Learning
- Silverlight魔幻銀燈
- 實戰(zhàn)Java高并發(fā)程序設(shè)計(第3版)
- JavaScript:Moving to ES2015
- 青少年P(guān)ython編程入門
- 單片機(jī)應(yīng)用與調(diào)試項目教程(C語言版)
- Couchbase Essentials
- 從零開始:C語言快速入門教程
- iOS Development with Xamarin Cookbook