# Trait cargo_credential::Credential

source ·

    pub trait Credential {
        // Required methods
        fn name(&self) -> &'static str;
        fn get(&self, index_url: &str) -> Result<String, Error>;
        fn store(
            &self,
            index_url: &str,
            token: &str,
            name: Option<&str>
        ) -> Result<(), Error>;
        fn erase(&self, index_url: &str) -> Result<(), Error>;
    }

## Required Methods§

source

#### fn name(&self) -> &'static str

Returns the name of this credential process.

source

#### fn get(&self, index_url: &str) -> Result<String, Error>

Retrieves a token for the given registry.

source

#### fn store( &self, index_url: &str, token: &str, name: Option<&str> ) -> Result<(), Error>

Stores the given token for the given registry.

source

#### fn erase(&self, index_url: &str) -> Result<(), Error>

Removes the token for the given registry.

If the user is not logged in, this should print a message to stderr if possible indicating that the user is not currently logged in, and return `Ok`.

## Implementors§

source§

### impl Credential for UnsupportedCredential