pub use xa11y_core::*;
pub fn create_provider() -> Result<Box<dyn Provider>> {
#[cfg(target_os = "macos")]
{
Ok(Box::new(xa11y_macos::MacOSProvider::new()?))
}
#[cfg(target_os = "windows")]
{
Ok(Box::new(xa11y_windows::WindowsProvider::new()?))
}
#[cfg(target_os = "linux")]
{
Ok(Box::new(xa11y_linux::LinuxProvider::new()?))
}
#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "linux")))]
{
Err(Error::Platform {
code: -1,
message: format!("Unsupported platform: {}", std::env::consts::OS),
})
}
}
pub fn create_event_provider() -> Result<Box<dyn EventProvider>> {
#[cfg(target_os = "macos")]
{
Ok(Box::new(xa11y_macos::MacOSProvider::new()?))
}
#[cfg(target_os = "windows")]
{
Ok(Box::new(xa11y_windows::WindowsProvider::new()?))
}
#[cfg(target_os = "linux")]
{
Ok(Box::new(xa11y_linux::LinuxProvider::new()?))
}
#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "linux")))]
{
Err(Error::Platform {
code: -1,
message: format!("Unsupported platform: {}", std::env::consts::OS),
})
}
}