Skip to main content

require_token

Function require_token 

Source
pub fn require_token(
    cli_token: Option<&str>,
    ledger_auth: &LedgerAuth,
) -> Result<Option<String>, Error>
Expand description

Resolves the token for publishing, failing fast with setup instructions if none found.

Returns Ok(Some(token)) if a token was found, Ok(None) if cargo’s own credentials should be used (tier 3 returned nothing – cargo may still succeed). Returns Err with actionable setup instructions if a tier 2 source was configured but failed.

§Errors

Returns Error::TokenResolution if a configured token source fails.