Back

rust - 下划线开头的变量名称的作用

发布时间: 2020-05-19 05:05:00

参考:https://stackoverflow.com/questions/48361537/why-do-underscore-prefixed-variables-exist

1. 该变量可能不会被使用

2. underscore binding

3. destruction的时候(解析某个结构体成为多个变量),如果解析出来5个,有3个不考虑,直接仍掉,那么就可以使用 _ 变量。

Back