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

Method get_value

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

Source from the content-addressed store, hash-verified

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