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

  • 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.

主站蜘蛛池模板: 万全县| 崇信县| 玉环县| 兰西县| 长葛市| 宜宾县| 广灵县| 安阳市| 吴忠市| 寿阳县| 周宁县| 梓潼县| 交口县| 镶黄旗| 临泽县| 宣威市| 思南县| 昌平区| 福安市| 宾阳县| 会同县| 海淀区| 平南县| 三河市| 湾仔区| 肇庆市| 阿拉尔市| 和静县| 栾川县| 承德县| 监利县| 玉田县| 玉屏| 黑河市| 灵川县| 澄江县| 邯郸县| 菏泽市| 宾川县| 图们市| 武安市|