-
Book Overview & Buying
-
Table Of Contents
Rust for C++ Developers
By :
After making a useful library or program, we may wish to share it with the wider Rust community. We can do this by publishing it to a Cargo registry. Most often, we will be using the official Rust registry at crates.io, but internal registries may be available in some organizations.
Each registry will have a different means of setting up an account. At the time of writing, the official Cargo registry only allows users to log in using a GitHub account. A GitHub account can be obtained by creating one on https://github.com/. Using GitHub is beyond the scope of this book, but it may also be able to provide hosting services for a Git repository containing our crate's source code.
Once an account has been created, we can use the cargo login command to obtain access to our chosen registry. Invoking it using the default configuration, we see the following:
$ cargo login
please paste the token found on https://crates.io/me below...