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

Starting a new project

Okay, so we've installed the compiler. Yay! But how do we use it?

The first step is to open up a command-line window, and navigate to the directory where we want to store our new project. Then we can create the skeleton of a new program with cargo new foo.

When we do this, cargo will create a new directory named foo and set up the skeletal program inside it.

The default is for cargo to create the skeleton of an executable program, but we can also tell it to set up a new library for us. All that takes is an additional command-line argument (bar is the name of the new directory that will be created, like foo): cargo new --lib bar.

When we look inside the newly created foo directory, we see a file called Cargo.toml and a sub-directory called src. There may also be a Git version control repository, which we will ignore for now.

主站蜘蛛池模板: 神木县| 钦州市| 巴林右旗| 湘潭市| 绥化市| 九龙城区| 咸宁市| 南丹县| 荥阳市| 建昌县| 诸城市| 河北省| 富顺县| 溧阳市| 稻城县| 余江县| 元氏县| 红桥区| 彝良县| 庐江县| 晋州市| 普陀区| 济宁市| 眉山市| 中西区| 乌兰浩特市| 庆阳市| 商都县| 伊川县| 淮北市| 台前县| 林州市| 阳江市| 湖南省| 玉林市| 兴宁市| 昭觉县| 清水县| 武安市| 防城港市| 绥化市|