Publishing to Cargo
Publishing
Section titled “Publishing”Cargo refuses to publish anywhere unless the crate says so. Add the registry to the manifest:
[package]name = "nitro-example"version = "0.1.0"description = "…"license = "MIT"publish = ["nitro"]Then:
cargo publish --registry nitroWithout publish, Cargo targets crates.io and stops with “the registry is not listed”. With
publish = false it refuses everywhere.
What happens
Section titled “What happens”Cargo packages the crate, then PUTs it to /api/v1/crates/new as two length-prefixed frames — the
metadata JSON, then the .crate file. The registry:
- checks the name and version are well formed;
- refuses the publish if that version already exists;
- computes the
cksumfrom the bytes it received, not from anything the client claimed; - stores the
.crateand writes the index record.
Cargo then polls the index until the new version shows up, which is the “waiting for … to be available” line.
Re-publishing is refused
Section titled “Re-publishing is refused”error: failed to publish to registry at …Caused by: crate version `[email protected]` already exists.A published version is immutable. Every lockfile that pins it, and every cksum in the index,
assumes the bytes never change. Publish a new version instead.
Yanking
Section titled “Yanking”cargo yank --registry nitro --version 0.1.0 nitro-examplecargo yank --registry nitro --version 0.1.0 --undo nitro-exampleYanking sets "yanked": true in the index. New resolutions skip the version; a lockfile that
already pins it keeps working, and the .crate stays downloadable. That is the whole difference
between yank and delete — and delete is not offered.
Owners
Section titled “Owners”cargo owner --registry nitro --list nitro-examplecargo owner --registry nitro --add someone nitro-examplecargo owner --registry nitro --remove someone nitro-exampleWhoever publishes a crate first becomes its owner. Adding or removing an owner needs more than
publish rights: the caller must already manage the crate, or be able to administer the repository.
Repository Write alone is not enough, because handing a crate to a third party is a stronger act
than pushing a version of it.
Searching
Section titled “Searching”cargo search --registry nitro nitroMatches the crate name and description.