pub struct UIState {
pub elements: Vec<Element>,
pub formatted_text: String,
pub focused_text: String,
pub phone_state: PhoneState,
pub screen: ScreenDimensions,
pub use_normalized: bool,
}Expand description
A snapshot of the device UI state.
Fields§
§elements: Vec<Element>§formatted_text: String§focused_text: String§phone_state: PhoneState§screen: ScreenDimensions§use_normalized: boolImplementations§
Source§impl UIState
impl UIState
pub fn new( elements: Vec<Element>, formatted_text: String, focused_text: String, phone_state: PhoneState, screen: ScreenDimensions, use_normalized: bool, ) -> Self
Sourcepub fn get_element(&self, index: usize) -> Option<&Element>
pub fn get_element(&self, index: usize) -> Option<&Element>
Find an element by index (recursive tree search).
Sourcepub fn get_element_coords(&self, index: usize) -> Result<(i32, i32)>
pub fn get_element_coords(&self, index: usize) -> Result<(i32, i32)>
Get the center (x, y) of an element by index.
Sourcepub fn get_element_info(&self, index: usize) -> Option<ElementInfo>
pub fn get_element_info(&self, index: usize) -> Option<ElementInfo>
Get element info for display.
Sourcepub fn get_clear_point(&self, index: usize) -> Result<(i32, i32)>
pub fn get_clear_point(&self, index: usize) -> Result<(i32, i32)>
Find a tap point that avoids overlapping elements.
Sourcepub fn convert_point(&self, x: i32, y: i32) -> Result<(i32, i32)>
pub fn convert_point(&self, x: i32, y: i32) -> Result<(i32, i32)>
Convert point to absolute pixels if normalized mode is active.
Sourcepub fn all_indices(&self) -> Vec<usize>
pub fn all_indices(&self) -> Vec<usize>
Get all element indices (flattened).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UIState
impl RefUnwindSafe for UIState
impl Send for UIState
impl Sync for UIState
impl Unpin for UIState
impl UnsafeUnpin for UIState
impl UnwindSafe for UIState
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