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

Method get_value

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

Source from the content-addressed store, hash-verified

212
213impl StringKey<'_> {
214 pub fn get_value(&self) -> String {
215 let config = get_config().unwrap_or_default();
216 let keys = self.0.to_owned();
217 let default_value = self.1.to_owned();
218 let mut result;
219 for key in keys {
220 if config.contains_key(key) {
221 result = config[key].as_str().unwrap().to_string()
222 } else {
223 result = env::var(get_env_name(key)).unwrap_or_default()
224 }
225 if key.eq(CACHE_PATH_KEY) {
226 // The configuration key for the cache path ("cache-path") is special because
227 // the rest of the configuration values depend on this value (since the
228 // configuration file is stored in the cache path). Therefore, this value needs
229 // to be discovered in the first place and stored globally (on CACHE_PATH)
230 return check_cache_path(result, default_value);
231 }
232 if !result.is_empty() {
233 return result;
234 }
235 }
236 default_value
237 }
238}
239
240pub 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