gcp-rust-tools 0.2.6

Comprehensive Google Cloud Platform tools for Rust: Observability (Logs, Metrics, Traces) and PubSub
Documentation
1
2
3
4
5
6
7
8
9
10
11
use std::env;

pub struct EnvVarGetter;

impl EnvVarGetter {
    pub fn get(key: &str) -> Result<String, String> {
        env::var(key)
            .map(|val| val.trim().to_string())
            .map_err(|_| format!("Environment variable '{}' is not set", key))
    }
}