How to create my own crate?

Can anyone guide me step by step on how to create my very own crate and publish on

Thank you !!!


Have you read the official Cargo documentation?


Oh yes...I did..but couldn't understand how to build a library ...

cargo new project_name;
cd project_name;
# edit src/
cargo doc --open # review what you've done
cargo publish # makes

src/ is your library, and everything that is pub in that file is your library's interface.


This may be a bit off topic so respectfully I do not want to steer away from @staymetal post. However, is there any public review or pruning process we can put our library through before we publish it (small feedback from the dev team or more experienced Rustaceans out there)? To my knowledge anyone can publish anything and I would like to make sure my library meets a certain level of expectation and standard before I publish something.


FYI - It will be quite some time before I publish anything but wanted to ask regardless.

1 Like

There are guidelines for self-review:

I think the current approach is to have no barriers to publishing, and instead rely on to help find good crates (currently it's merely a popularity contest, but other ranking methods have been discussed).


If you want review, I'd recommend publishing a 0.0.1 version on, then posting it here or on /r/rust.

If you have a github repository with the source, and you've documented things, people will be glad to give it a run through and see if they can find anything. It's not too formal, but it isn't uncommon to see new crate authors making this kind of post asking for reviews.

1 Like