openfunctions_rs/runtime/
environment.rs

1//! Manages the environment variables for tool execution.
2
3use std::collections::HashMap;
4
5/// Environment manager for tool execution.
6pub struct Environment {
7    variables: HashMap<String, String>,
8}
9
10impl Environment {
11    /// Create a new environment manager.
12    pub fn new() -> Self {
13        Self {
14            variables: HashMap::new(),
15        }
16    }
17
18    /// Get the base environment variables.
19    pub fn get_base_env(&self) -> HashMap<String, String> {
20        self.variables.clone()
21    }
22
23    /// Set an environment variable.
24    pub fn set(&mut self, key: String, value: String) {
25        self.variables.insert(key, value);
26    }
27}
28
29impl Default for Environment {
30    fn default() -> Self {
31        Self::new()
32    }
33}