MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / parse_modifier_mask

Function parse_modifier_mask

packages/server/src/main/input_helpers.rs:208–229  ·  view source on GitHub ↗
(value: &str)

Source from the content-addressed store, hash-verified

206}
207
208fn parse_modifier_mask(value: &str) -> Result<u32, crate::error::AppError> {
209 let mut mask = 0;
210 for token in value
211 .split(',')
212 .map(str::trim)
213 .filter(|token| !token.is_empty())
214 {
215 mask |= match token.to_lowercase().as_str() {
216 "shift" | "225" | "left-shift" => 1,
217 "ctrl" | "control" | "224" | "left-control" => 1 << 1,
218 "alt" | "option" | "226" | "left-option" => 1 << 2,
219 "cmd" | "command" | "meta" | "227" | "left-command" => 1 << 3,
220 "caps" | "caps-lock" | "57" => 1 << 4,
221 other => {
222 return Err(crate::error::AppError::bad_request(format!(
223 "Unsupported modifier `{other}`."
224 )))
225 }
226 };
227 }
228 Ok(mask)
229}

Callers 2

mainFunction · 0.85
run_batch_stepFunction · 0.85

Calls 2

is_emptyMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected