Crates.io | rlb01_hello-cargo |
lib.rs | rlb01_hello-cargo |
version | 0.2.0 |
source | src |
created_at | 2023-12-12 01:49:13.699177 |
updated_at | 2023-12-12 02:08:16.597455 |
description | A hello world program in Rust |
homepage | https://github.com/poneding/learning-rust/tree/master/rust-lang-book/rlb01_hello-cargo |
repository | https://github.com/poneding/learning-rust/tree/master/rust-lang-book/rlb01_hello-cargo |
max_upload_size | |
id | 1065757 |
size | 3,226 |
cargo new rlb01_hello-cargo
cd rlb01_hello-cargo
可以使用
cargo new --vcs git rlb01_hello-cargo
创建项目并初始化 git 仓库,它将自动创建一个 .gitignore 文件。
cargo build
# 编译之后将在 target/debug 目录下生成可执行文件
# 可以通过以下命令运行
./target/debug/rlb01_hello-cargo
cargo run
cargo check
cargo install --path .
发布到 crates.io,需要注册账号。
并且,需要在 Cargo.toml 中添加部分内容,例如作者、描述、许可证必要信息以及其他信息:
[package]
name = "rlb01_hello-cargo"
version = "0.2.0"
edition = "2021"
authors = ["Pone Ding <poneding@gmail.com>"]
description = "A hello world program in Rust"
license = "MIT OR Apache-2.0"
readme = "README.md"
keywords = ["hello", "world"]
categories = ["hello-world"]
repository = "https://github.com/poneding/learning-rust/tree/master/rust-lang-book/rlb01_hello-cargo"
homepage = "https://github.com/poneding/learning-rust/tree/master/rust-lang-book/rlb01_hello-cargo"
cargo publish
# 忽略未提交的更改
cargo publish --allow-dirty