MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / get_value

Method get_value

rust/src/config.rs:200–223  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

198
199impl StringKey<'_> {
200 pub fn get_value(&self) -> String {
201 let config = get_config().unwrap_or_default();
202 let keys = self.0.to_owned();
203 let default_value = self.1.to_owned();
204 let mut result;
205 for key in keys {
206 if config.contains_key(key) {
207 result = config[key].as_str().unwrap().to_string()
208 } else {
209 result = env::var(get_env_name(key)).unwrap_or_default()
210 }
211 if key.eq(CACHE_PATH_KEY) {
212 // The configuration key for the cache path ("cache-path") is special because
213 // the rest of the configuration values depend on this value (since the
214 // configuration file is stored in the cache path). Therefore, this value needs
215 // to be discovered in the first place and stored globally (on CACHE_PATH)
216 return check_cache_path(result, default_value);
217 }
218 if !result.is_empty() {
219 return result;
220 }
221 }
222 default_value
223 }
224}
225
226pub struct IntegerKey<'a>(pub &'a str, pub u64);

Callers 3

defaultMethod · 0.80
mainFunction · 0.80
newMethod · 0.80

Calls 4

get_configFunction · 0.85
get_env_nameFunction · 0.85
check_cache_pathFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected