pub struct EnvFetch { /* private fields */ }Available on crate feature
fetcher-env only.Expand description
KeyFetch implementation that reads bytes from a process environment
variable.
The variable name is configured at construction. The variable’s bytes are returned verbatim — no decoding, no trimming, no parsing.
§Examples
use key_vault::{EnvFetch, FetchContext, KeyFetch};
// SAFETY for the example: setting an env var in a single-threaded
// doctest is fine. Real applications should set keys via the
// orchestration layer (Kubernetes Secrets, AWS Lambda env, etc.).
unsafe { std::env::set_var("MY_APP_KEY", "very-secret-value"); }
let fetcher = EnvFetch::new("MY_APP_KEY");
let ctx = FetchContext::new("my-key");
let raw = fetcher.fetch(&ctx)?;
assert_eq!(raw.len(), "very-secret-value".len());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EnvFetch
impl RefUnwindSafe for EnvFetch
impl Send for EnvFetch
impl Sync for EnvFetch
impl Unpin for EnvFetch
impl UnsafeUnpin for EnvFetch
impl UnwindSafe for EnvFetch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more