pub struct Registry {
pub name: String,
pub api_base: String,
pub index_base: Option<String>,
}Expand description
Represents a Cargo registry for publishing crates.
A registry is identified by its name (used with cargo publish --registry <name>)
and its API/base URLs. The default registry is crates.io, which can be created
using Registry::crates_io().
§Example
use shipper::types::Registry;
// Use crates.io (default)
let crates_io = Registry::crates_io();
// Custom registry
let my_registry = Registry {
name: "my-registry".to_string(),
api_base: "https://my-registry.example.com".to_string(),
index_base: Some("https://index.my-registry.example.com".to_string()),
};Fields§
§name: StringCargo registry name (for cargo publish --registry <name>). For crates.io this is typically crates-io.
api_base: StringBase URL for registry web API, e.g. https://crates.io.
index_base: Option<String>Base URL for the sparse index, e.g. https://index.crates.io.
If not specified, will be derived from the API base.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn crates_io() -> Self
pub fn crates_io() -> Self
Creates a new Registry configured for crates.io.
This is the default registry used by Cargo and is the most common target for publishing Rust crates.
§Returns
A Registry with:
- name:
"crates-io" - api_base:
"https://crates.io" - index_base:
Some("https://index.crates.io")
§Example
use shipper::types::Registry;
let registry = Registry::crates_io();
assert_eq!(registry.name, "crates-io");
assert_eq!(registry.api_base, "https://crates.io");Sourcepub fn get_index_base(&self) -> String
pub fn get_index_base(&self) -> String
Get the index base URL, deriving it from the API base if not explicitly set.
Strips the sparse+ prefix if present (used by Cargo’s sparse index config).