I am making a program that accepts strings that correlate to keys on a keyboard using Enigo. Currently, I'm using a match statement to access the modules, I'd ultimately like to use some way of accessing them using the strings themselves.
match action.as_str() {
"Meta" => Key::Meta,
"Control" => Key::Control,
"Alt" => Key::Alt,
"Tab" => Key::Tab,
"Shift" => Key::Shift,
"Space" => Key::Space,
"Esc" => Key::Escape,
&_ => Key::Layout(action.chars().next().unwrap()),
}
Is there a way do this using something like a module.get(&str)
or something?