Skip to main content

CredentialBearing

Trait CredentialBearing 

Source
pub trait CredentialBearing {
    // Required method
    fn credentials(&self) -> Vec<(&'static str, &CredentialRef)>;
}
Expand description

Exposes the CredentialRefs in a downstream tool’s config to rtb-cli’s credentials subtree.

Tools implement this on their typed Config struct (or any other type the App carries that owns its credentials):

use rtb_credentials::{CredentialBearing, CredentialRef};

struct MyConfig {
    anthropic: AnthropicSection,
    github: GithubSection,
}
struct AnthropicSection { api: CredentialRef }
struct GithubSection   { token: CredentialRef }

impl CredentialBearing for MyConfig {
    fn credentials(&self) -> Vec<(&'static str, &CredentialRef)> {
        vec![
            ("anthropic", &self.anthropic.api),
            ("github",    &self.github.token),
        ]
    }
}

The &'static str name is the human-friendly identifier surfaced by credentials list and accepted as the argument to credentials add / remove / test.

Required Methods§

Source

fn credentials(&self) -> Vec<(&'static str, &CredentialRef)>

Yield (name, &CredentialRef) pairs for every credential this value owns.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CredentialBearing for ()

Blanket impl for () — tools that haven’t typed their config yet still build. credentials list reports an empty set.

Source§

fn credentials(&self) -> Vec<(&'static str, &CredentialRef)>

Implementors§