#[non_exhaustive]pub struct Credentials { /* private fields */ }Expand description
Parsed credentials.toml.
An absent file yields the default (no keys); unreadable and malformed are
CredentialsError, which load_or_default turns back into the
default for the fetch path so one bad line cannot take a fetch down.
Per-entry problems ride along as Advisory values. Nothing about this
file is dropped in silence — that is what cost a user their configuration.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn api_key(&self, publisher: &str) -> Option<&str>
pub fn api_key(&self, publisher: &str) -> Option<&str>
The api_key for publisher, if the file supplied one.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
How many publishers supplied a usable key.
For config doctor, which reports that a credentials file was read
without printing anything from it.
Sourcepub fn advisories(&self) -> &[Advisory]
pub fn advisories(&self) -> &[Advisory]
Everything worth telling the user that did not stop the file being
used. See Advisory.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Credentials
Hand-written so a stray {:?} cannot print a publisher API key.
impl Debug for Credentials
Hand-written so a stray {:?} cannot print a publisher API key.
TdmGrant wraps the same value in secrecy::SecretString precisely so
Debug never renders it; between this file and that wrapper the key is
a plain String, and a #[derive(Debug)] here would have re-opened the
hole one hop earlier. Publisher names are not secret and are shown.