1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! [`CredentialProvider`] — the type-erased object [`crate::app::App`]
//! stores so commands can enumerate credentials without `App` itself
//! becoming generic over the downstream tool's config type.
//!
//! # Why two traits?
//!
//! [`rtb_credentials::CredentialBearing`] returns
//! `Vec<(&'static str, &CredentialRef)>` — borrows tied to the
//! provider's lifetime. That's the right shape for *implementing*
//! the trait on a typed config struct, but not for storing a
//! type-erased `Box<dyn …>` on `App` (no lifetime to anchor the
//! borrows to).
//!
//! `CredentialProvider` is the storage-side dual: returns owned
//! `Vec<(String, CredentialRef)>`. There is a blanket impl for
//! every `T: CredentialBearing + Send + Sync + 'static` — downstream
//! tools implement `CredentialBearing` once and the framework
//! converts on demand.
use Arc;
use ;
/// Type-erased credential listing. Stored on [`crate::app::App`] as
/// `Option<Arc<dyn CredentialProvider>>`.
/// Blanket impl wrapping any `CredentialBearing` + `Send` + `Sync`
/// type. Downstream tools `impl CredentialBearing for MyConfig`
/// once and `Application::builder().credentials_from(Arc::new(my_config))`
/// just works.
/// Convenience: an empty provider. Used by `App::for_testing` and
/// any tool that hasn't wired a provider yet.
;
/// Test-friendly handle: the wrapped provider when `Some`, or an
/// empty listing when `None`. Used by [`crate::app::App::credentials`].