![]() When community members try to use these templates, it may lead to issues that could have a hurt on the community. Over time, this will grow and many will go unmaintained. ![]() With cargo supporting templates, this may lead to a large influx of community-created templates. To summarize, the following is the syntax for using a templateÄrawbacks Unmaintained templates -> negative effect on the community Note: the same examples could be used with cargo init as well. cargo new my-new-app -template my-crate/advanced-app.cargo new my-new-app -template my-crate/basic-app.cargo new my-new-app -template my-crate/hello-world.If this were a real crate, the following would be valid ways to initialize a project with the my-crate templates: the template lives inside the templates directory, which lives at the root of the crate.the package is on the crates.io registry.Templates can be created by any package as long as they follow these conventions: The added feature will be the ability to use a template that exists within a package on the crates.io registry. Reference-level explanationĬargo new and cargo init will work the same way as usual. To view other rocket templates, see the templates directory in the root of the rocket repository on GitHub. This will create a new cargo project called my-rocket-app using the hello-world template. Note: this option is also supported with the init command: cargo init my-rocket-app -template rocket/hello-world To use this run the following: cargo new my-rocket-app -template rocket/hello-world ![]() For example, we'll try this using the hello-world template in the rocket crate. Let's create a new project using Cargo and a template from the registry. support templates that live on the crates.io registry inside a directory called templates at the root of a crate.We're doing this to make it "easy for frameworks to ship starter templates to users to give users the dependencies, stubs etc that they need" - : cargo new templates - #10 by withoutboats. Add the ability to reference a template when running cargo new or cargo init Motivation
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |