Skip to main content

xa11y_linux/
stub.rs

1//! Stub backend for non-Linux platforms (allows compilation on all targets).
2
3use xa11y_core::{Action, ActionData, ElementData, Error, Provider, Result, Subscription};
4
5#[derive(Default)]
6pub struct LinuxProvider;
7
8impl LinuxProvider {
9    pub fn new() -> Result<Self> {
10        Ok(Self)
11    }
12}
13
14impl Provider for LinuxProvider {
15    fn get_children(&self, _: Option<&ElementData>) -> Result<Vec<ElementData>> {
16        Err(Error::Platform {
17            code: -1,
18            message: "Linux backend not available on this platform".to_string(),
19        })
20    }
21
22    fn get_parent(&self, _: &ElementData) -> Result<Option<ElementData>> {
23        Err(Error::Platform {
24            code: -1,
25            message: "Linux backend not available on this platform".to_string(),
26        })
27    }
28
29    fn perform_action(&self, _: &ElementData, _: Action, _: Option<ActionData>) -> Result<()> {
30        Err(Error::Platform {
31            code: -1,
32            message: "Linux backend not available on this platform".to_string(),
33        })
34    }
35
36    fn subscribe(&self, _: &ElementData) -> Result<Subscription> {
37        Err(Error::Platform {
38            code: -1,
39            message: "Linux backend not available on this platform".to_string(),
40        })
41    }
42}