Skip to content

Commit feb6d88

Browse files
committed
feat(cred): Common unsupported credentials
1 parent 60bf28f commit feb6d88

File tree

1 file changed

+20
-0
lines changed
  • crates/credential/cargo-credential/src

1 file changed

+20
-0
lines changed

crates/credential/cargo-credential/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@ pub trait Credential {
3434
fn erase(&self, index_url: &str) -> Result<(), Error>;
3535
}
3636

37+
pub struct UnsupportedCredential;
38+
39+
impl Credential for UnsupportedCredential {
40+
fn name(&self) -> &'static str {
41+
"unsupported"
42+
}
43+
44+
fn get(&self, _index_url: &str) -> Result<String, Error> {
45+
Err("unsupported".into())
46+
}
47+
48+
fn store(&self, _index_url: &str, _token: &str, _name: Option<&str>) -> Result<(), Error> {
49+
Err("unsupported".into())
50+
}
51+
52+
fn erase(&self, _index_url: &str) -> Result<(), Error> {
53+
Err("unsupported".into())
54+
}
55+
}
56+
3757
/// Runs the credential interaction by processing the command-line and
3858
/// environment variables.
3959
pub fn main(credential: impl Credential) {

0 commit comments

Comments
 (0)