官术网_书友最值得收藏!

  • Rust Quick Start Guide
  • Daniel Arbuckle
  • 131字
  • 2021-06-10 19:46:03

Accessing module contents from outside

In the A module as a section of a file section, the a_second_thing function is part of the same module as a_thing, so it's automatically allowed to use the short version of the other function's name to refer to it. However, code outside of the module needs to use the full name to refer to items inside the module. There are two ways this can be done. It can either be done directly, which is a good choice if we don't expect to be referring to the item often, or we can tell Rust that we want to use the short name for an item in a different module, which is a good choice if we're going to be using that item often in our code.

主站蜘蛛池模板: 格尔木市| 贺州市| 全椒县| 安塞县| 十堰市| 南宫市| 祥云县| 敦煌市| 东港市| 望江县| 教育| 罗平县| 恩平市| 大荔县| 湘潭县| 息烽县| 剑河县| 府谷县| 九龙坡区| 穆棱市| 阳春市| 肇庆市| 门源| 上饶县| 兴化市| 涿鹿县| 贵德县| 黄骅市| 乌鲁木齐县| 高州市| 积石山| 嘉鱼县| 石棉县| 禄丰县| 福泉市| 进贤县| 清流县| 临江市| 宜兴市| 句容市| 蕉岭县|