最终用户 utilities/applications 是否应该在 crates.io 上注册?

Should end user utilities/applications be registered on crates.io?

crates.io 上注册普遍有用的(实用程序/应用程序)是否可以接受?

FAQ 没有解决这个问题,通过浏览,有最终用户应用程序的示例(主要是命令行工具)。

还是crates.io?仅适用于图书馆?


我问这个是因为文档暗示了库的使用、API 的语义版本控制等,但没有明确引用打包应用程序的情况。

是的,因为您可以使用 cargo install 在系统范围内安装和管理这些应用程序。如果不鼓励这种使用,我会怀疑该命令根本不存在,或者至少适用性非常有限。

来自 cargo install --help 的片段:

Usage:

 cargo install [options] [<crate>]
 cargo install [options] --list

[...]

This command manages Cargo's local set of installed binary crates. Only packages which have [[bin]] targets can be installed, and all binaries are installed into the installation root's bin folder. The installation root is determined, in order of precedence, by --root, $CARGO_INSTALL_ROOT, the install.root configuration key, and finally the home directory (which is either $CARGO_HOME if set or $HOME/.cargo by default).

There are multiple sources from which a crate can be installed. The default location is crates.io but the --git and --path flags can change this source. If the source contains more than one package (such as crates.io or a git repository with multiple crates) the <crate> argument is required to indicate which crate should be installed.

这不应该是将应用程序发布到 crates.io 的主要原因,但我在这里列出它是因为它仍然是一个很好的理由。 :)

Rust 团队偶尔会使用一个名为 crater 的工具来检查 crates.io 上发布的所有板条箱的回归,通常在合并具有不确定结果的拉取请求之前。如果您编写的代码今天碰巧可以编译,但由于编译器中的错误修复而停止编译1,那么他们甚至可能会向您的项目提交拉取请求来修复您的代码!


1 通常,当发生这种破坏性更改时,至少有一个先前版本会在警告变成错误之前报告警告。