pub struct Tree {
pub app_name: String,
pub pid: Option<u32>,
pub screen_size: (u32, u32),
/* private fields */
}Expand description
A snapshot of an application’s accessibility tree.
The tree is a flattened snapshot — nodes are stored in DFS order and reference each other by internal indices.
This type is internal to provider implementations. End users should
use Node (returned by xa11y::app(), etc.) which wraps
a Tree with navigation methods.
Fields§
§app_name: StringApplication name
pid: Option<u32>Process ID. None for multi-app queries.
screen_size: (u32, u32)Screen dimensions at capture time (width, height)
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn new(
app_name: String,
pid: Option<u32>,
screen_size: (u32, u32),
nodes: Vec<NodeData>,
) -> Self
pub fn new( app_name: String, pid: Option<u32>, screen_size: (u32, u32), nodes: Vec<NodeData>, ) -> Self
Create a new Tree from a list of nodes.
Sourcepub fn get_data(&self, index: u32) -> Option<&NodeData>
pub fn get_data(&self, index: u32) -> Option<&NodeData>
Get a node’s data by its internal index.
Sourcepub fn parent_data(&self, node: &NodeData) -> Option<&NodeData>
pub fn parent_data(&self, node: &NodeData) -> Option<&NodeData>
Get the parent of a node.
Sourcepub fn children_data(&self, node: &NodeData) -> Vec<&NodeData>
pub fn children_data(&self, node: &NodeData) -> Vec<&NodeData>
Get direct children of a node.
Sourcepub fn subtree_indices(&self, index: u32) -> Vec<u32>
pub fn subtree_indices(&self, index: u32) -> Vec<u32>
Get indices of the subtree rooted at a node (including the node itself).
Sourcepub fn query_indices(&self, selector_str: &str) -> Result<Vec<u32>>
pub fn query_indices(&self, selector_str: &str) -> Result<Vec<u32>>
Query node indices matching a CSS-like selector string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tree
impl<'de> Deserialize<'de> for Tree
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more