November 17, 2021
How to Publish Your First Rust Crate?
With crates, you share your work with other developers, learn how to publish your first crate.
Photo by Björn Austmar Þórsson from Pexels
You Need an Account
Before you start publishing any crate to crates.io, you first have to create an account.
- Go to crates.io
- Login with GitHub
- Verify your Email
Then Login
- Create a New Token form Account Settings in the API Access section
- Run the command you get to the login
Get Your Project Ready
- Add the following fields in the Cargo.toml file
- license or license-file
- description
- documentation
- homepage or repository
- You need to commit your work before publishing
- Do a dry run by running
cargo publish --dry-run
- Fix any errors or warnings after the dry run
And Publish
cargo publish