pub struct Env { /* private fields */ }Expand description
leash.env() — runtime env-var fetcher with an in-memory TTL cache.
Implementations§
Source§impl Env
impl Env
Sourcepub async fn get(&self, key: &str) -> Result<Option<String>>
pub async fn get(&self, key: &str) -> Result<Option<String>>
Resolve a single env-var by name, using the TTL cache.
Returns Ok(None) when the platform reports the key as not declared
or not found anywhere (HTTP 404). All other failures surface as
LeashError.
Sourcepub async fn get_fresh(&self, key: &str) -> Result<Option<String>>
pub async fn get_fresh(&self, key: &str) -> Result<Option<String>>
Like Self::get but bypasses the cache read. The freshly-fetched
value is still written back to the cache.
Equivalent to the TS leash.env.get(key, { fresh: true }) option.
Sourcepub async fn get_many(
&self,
keys: &[&str],
) -> Result<HashMap<String, Option<String>>>
pub async fn get_many( &self, keys: &[&str], ) -> Result<HashMap<String, Option<String>>>
Resolve multiple env-vars sequentially, sharing the TTL cache.
If any key fails (auth, plan, network), the whole call returns that
error — partial results are not surfaced (matches Go behaviour). Each
value is Option<String> so callers can distinguish “missing” (None)
from “empty string” (Some("")).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Env
impl !RefUnwindSafe for Env
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl UnsafeUnpin for Env
impl !UnwindSafe for Env
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