JetBrains Space Help

Publish Rust Packages

Suppose you want to publish a crate package to the newly created sparse registry using:

Publish packages using Cargo command-line tool

  1. Configure connection to the Cargo registry. The instructions are different for a local Cargo registry and for a mirror of a remote registry (the most common case is mirroring crates.io):

    1. In your Rust project, add the config.toml file to the .cargo directory.

    2. Add the registry data to the config.toml file. For example:

      [registries.space-registry] index = "sparse+https://cargo.registry.jetbrains.space/mycompany/p/projectkey/myCrates" credential-provider="cargo:token"

      If you are not sure about the URL, you can copy the URL of a particular container registry on the Packages page.

    3. Log in to the registry:

      cargo login --registry=space-registry

      Here space-registry is the registry name you specified in config.toml.

    4. When asked for credentials, specify either your Space username and password (we recommend that you use a personal token instead) or a client ID and a client secret of a service account.

    1. In your Rust project, add the config.toml file to the .cargo directory.

    2. Add the registry data to the config.toml file. For example:

      [registries.space-registry-mirror] index = "sparse+https://cargo.registry.jetbrains.space/mycompany/p/projectkey/myCrates-mirror" credential-provider="cargo:token"

      If you are not sure about the URL, you can copy the URL of a particular container registry on the Packages page.

    3. Log in to the registry:

      cargo login --registry=space-registry-mirror

      Here space-registry-mirror is the registry name you specified in config.toml.

    4. When asked for credentials, specify either your Space username and password (we recommend that you use a personal token instead) or a client ID and a client secret of a service account.

    5. Open the config.toml and configure registry replacing by adding the lines:

      [source] space-registry-mirror = { registry = "sparse+https://cargo.registry.jetbrains.space/mycompany/p/projectkey/myCrates-mirror" } crates-io = { replace-with = "space-registry-mirror" }
  2. Publish the package to the registry:

    cargo publish --registry=space-registry

Publish packages from Space Automation

For the instructions on how to publish Rust packages from Space Automation, refer to Space Automation examples.

Last modified: 22 September 2023