2.3. 创建 Rust 库项目
完成以下步骤,使用 libpmemgo 构建工具创建 Rust 库项目。
流程
要创建 Rust 库项目,请运行以下命令:
在 Red Hat Enterprise Linux 7 上:
$ scl enable rust-toolset-1.66 'cargo new --lib <project_name>'
-
将
<project_name
> 替换为 Rust 项目的名称。
-
将
在 Red Hat Enterprise Linux 8 中:
$ cargo new --lib <project_name>
-
将
<project_name
> 替换为 Rust 项目的名称。
-
将
在 Red Hat Enterprise Linux 9 中:
$ cargo new --lib <project_name>
-
将
<project_name
> 替换为 Rust 项目的名称。
-
将
注意
若要编辑项目代码,请编辑 src
子目录中的源代码 lib.rs
。