我可以修改默认的“ main.rs.rs”的内容。归档生锈?
当您使用货物新名称>
时,货物将创建一个带有“ main.rs”和其他文件的新项目。在“ main.rs”文件中总是写入的,
fn main() {
println!("Hello, World!");
}
是否可以修改“ main.rs”文件的默认内容?如果可能的话,如何?
When you use cargo new <name>
, cargo creates a new project with a "main.rs" and other files. In the "main.rs" file is always written
fn main() {
println!("Hello, World!");
}
Is it possible to modify the default content of the "main.rs" file? If it is possible, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,
main.rs
的初始文件内容(如果创建二进制)或lib.rs
(如果创建库)为您可以尝试使用
cargo-generate
来自GIT回购模板的项目。参见其文档有关如何使用它的信息。No, the initial file contents for
main.rs
(if creating a binary) orlib.rs
(if creating a library) are hardcoded into Cargo.You could try using
cargo-generate
to be able to generate Cargo projects from a Git repo template. See its documentation for information about how to use it.