| 23 | |
| 24 | impl AccessibilitySource { |
| 25 | pub fn parse(value: Option<&str>) -> Result<Self, String> { |
| 26 | match value.unwrap_or("auto").trim().to_lowercase().as_str() { |
| 27 | "" | "auto" => Ok(Self::Auto), |
| 28 | "nativescript" | "ns" => Ok(Self::NativeScript), |
| 29 | "react-native" | "reactnative" | "rn" => Ok(Self::ReactNative), |
| 30 | "flutter" | "fl" => Ok(Self::Flutter), |
| 31 | "swiftui" | "swift-ui" => Ok(Self::SwiftUI), |
| 32 | "uikit" | "in-app-inspector" => Ok(Self::UIKit), |
| 33 | "ax" | "native-ax" | "native-accessibility" => Ok(Self::NativeAX), |
| 34 | "android-uiautomator" => Ok(Self::AndroidUiautomator), |
| 35 | source => Err(format!( |
| 36 | "Unsupported accessibility hierarchy source `{source}`." |
| 37 | )), |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | pub fn as_query_value(self) -> &'static str { |
| 42 | match self { |