Create an amazing Rust GitHub project in no time

Create an amazing Rust GitHub project in no time

Boring introduction

Expectations on open source projects are becoming higher and higher everyday. If a project is not well documented or it doesn't have a test suite and a continuous integration environment, it is very unlikely that it will be taken seriously by the community.

Luckily for us, the tools to create high quality projects are becoming better and better at the same time, too.

For example, rust provides:

  • the cargo build system which includes built-in support for tests and documentation
  • clippy static code analyzer
  • rustfmt auto formatting tool

These tools are well established and they are used by all the relevant rust projects. The rust ecosystem, in fact, is really homogeneous, in the sense that the way you build, test, run and deploy a certain application/library is very standard.

Therefore, when you are creating a new project, it's really likely that you can recycle documentation and CI steps from your older projects or other bigger rust projects out there..which is great, but as my java professor taught me:

if you are copying and pasting several times, you are almost surely doing it wrong!

And that's exactly what I was doing. ??

In fact, every time I was creating a new GitHub project, I was using the good old copying and pasting technique on:

  • the set of markdown files that GitHub asks you to fill, such as CONTRIBUTING.md, CHANGELOG.md, CODE_OF_CONDUCT.md, issue and pull request templates, and most importantly the README.md with all the fancy badges.
  • the files needed to setup the CI environment, most of the time GitHub actions, specifically.

We can do better than this. ??

Cargo generate

In order to avoid copying and pasting, there is the cargo generate tool, which is described as:

A developer tool to help you get up and running quickly with a new Rust project by leveraging a pre-existing git repository as a template.

This means that you can setup a template repository, with all the files you need and you ask cargo generate to create a project starting from this template, by replacing your project name and authors (and git username soon?).

After using this tool to create some rust embedded projects with really little effort, I immediately appreciated its power. Therefore, during these days I decided to use it to create a new template which makes me skip the copying and pasting phase when creating a new rust project hosted on GitHub.

Rust GitHub Template

You can find more info about Rust GitHub Template on its own website, where I described its features and instructions on how to use it to create a new rust project.

In short, it allows you to create a new rust project which already includes documentation and GitHub actions such as automatic security checks, Continuous Integration and Continuous Deployment already set up by only specifying project name and GitHub username. You can see an example project generated by this template here.

You can think of it as a bloated version of cargo new ??

As the Rust GitHub Template website states:

Stop copy pasting tons of markdown and yaml files each time you start a new rust project. Let’s write them only once, together!

Thanks, and I hope you enjoy using Rust GitHub Template! ??

Check out my other blog posts at https://www.marcoieni.com/ ??

要查看或添加评论,请登录

Marco Ieni的更多文章

  • RustShip: a new Rust podcast

    RustShip: a new Rust podcast

    I’m excited to announce that I started RustShip: a new podcast where I interview other Rust developers to learn from…

  • 2022 recap, 2023 goals

    2022 recap, 2023 goals

    Another year has gone by, and December is the perfect time to reflect on what we’ve done in the past 12 months. Wait…

    4 条评论
  • Release-plz: release Rust packages from CI

    Release-plz: release Rust packages from CI

    Releasing Rust packages is tedious and error-prone, just like most IT manual tasks. For every package you want to…

  • CKAD: 2021 tips, vimrc, bashrc and cheatsheet

    CKAD: 2021 tips, vimrc, bashrc and cheatsheet

    You are probably busy studying for you exam right now, so I will try to be brief. In the following I will share the…

    2 条评论
  • My 2020 Recap: Open Source, talks, meetups and more!

    My 2020 Recap: Open Source, talks, meetups and more!

    I am not a huge fan of year recaps or new year’s resolutions. Mainly because I don’t like thinking about the past in…

    2 条评论
  • Rust makes cross compilation child's play

    Rust makes cross compilation child's play

    Why do I care about this Recently I solved this delta issue, where the maintainer asked to switch from Travis CI to…

  • ?? 2 videos about rust code coverage in VSCode

    ?? 2 videos about rust code coverage in VSCode

    Useless personal stuff It's several years now that I feel the need to share what I learn with other people. I gained so…

  • Continuous integration with VHDL

    Continuous integration with VHDL

    Skippable introduction During this lockdown (like almost everyone) I have a lot of free time, so I decided to give a…

  • Doc-org: org-mode + latex + docker = pdf

    Doc-org: org-mode + latex + docker = pdf

    For better formatting read this article on my website: Why plain text is better than word processors I was so tired of…

  • Linux on my 32GB windows tablet is surprisingly good

    Linux on my 32GB windows tablet is surprisingly good

    For better formatting read this article on my website ?? Why I removed windows from my tablet I have a HP Pavilion X2…

社区洞察

其他会员也浏览了