pub struct CargoRegistry {
http: HttpRegistry,
base: Url,
route: Route,
}Expand description
A Cargo registry version lookup.
The crates.io registry answers api/v1/crates/{name}/{version}. A named
registry is read through its sparse index file for the crate, and a version
counts as present when it is listed, yanked or not.
A request that fails to connect, answers 429, or answers a server error is retried up to four attempts with a doubling delay.
The token is sent as Authorization: token <value> and only to the
configured registry host. Every request is built under the registry URL,
and a redirect to another host drops the header.
Fields§
§http: HttpRegistry§base: Url§route: RouteImplementations§
Source§impl CargoRegistry
impl CargoRegistry
Sourcepub fn new(base: Url, token: Option<&Token>) -> Result<Self, RegistryError>
pub fn new(base: Url, token: Option<&Token>) -> Result<Self, RegistryError>
Look up versions under the crates.io API base base.
A missing trailing slash on the path is added. Without a token,
requests are anonymous.
§Errors
Fails when the token is not a valid header value or the HTTP client cannot start.
Sourcepub fn sparse_index(
base: Url,
token: Option<&Token>,
) -> Result<Self, RegistryError>
pub fn sparse_index( base: Url, token: Option<&Token>, ) -> Result<Self, RegistryError>
Look up versions in the sparse index rooted at base, as served by a
named registry.
§Errors
Fails when the token is not a valid header value or the HTTP client cannot start.