antithesis_sdk 0.2.7

Rust SDK for the Antithesis autonomous software testing platform.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::env;

pub fn set_var(k: &str, v: &str) -> Option<String> {
    let prev_v = env::var(k);
    env::set_var(k, v);
    prev_v.ok()
}

pub fn restore_var(k: &str, maybe_v: Option<String>) {
    match maybe_v {
        None => env::remove_var(k),
        Some(prev_v) => env::set_var(k, prev_v.as_str()),
    };
}