Struct SemanticTree
pub struct SemanticTree { /* private fields */ }Expand description
The retained accessibility tree. Persists node identity across frames and
diffs each refresh against the previous.
Implementations§
§impl SemanticTree
impl SemanticTree
pub fn new() -> SemanticTree
pub fn refresh(
&mut self,
root: &dyn Widget,
node_map: &HashMap<NodeId, *mut dyn Widget>,
focused: Option<NodeId>,
resources: &[Resource],
) -> TreeDelta
pub fn refresh( &mut self, root: &dyn Widget, node_map: &HashMap<NodeId, *mut dyn Widget>, focused: Option<NodeId>, resources: &[Resource], ) -> TreeDelta
Rebuild the tree from the live UI and diff it against the retained frame.
node_map is used read-only (never dereferenced) to assign each
widget its stable id. Ambiguous registrations remain structural and
receive no layout dispatch id. focused folds
into each node’s AccessState::focused. resources is the focused
app’s open-resource forest
([Widget::resources]); each
exported ActionSpec becomes an invokable
affordance.
pub fn root(&self) -> &SemanticId
pub fn node(&self, id: &SemanticId) -> Option<&SemanticNode>
pub fn iter(&self) -> impl Iterator<Item = &SemanticNode>
pub fn iter(&self) -> impl Iterator<Item = &SemanticNode>
Stable DFS reading order.
pub fn duplicate_ids(&self) -> &[SemanticId]
pub fn duplicate_ids(&self) -> &[SemanticId]
Duplicate durable keys are never silently accepted as stable identity.
pub fn find_by_name(&self, name: &str) -> Option<&SemanticNode>
pub fn find_by_name(&self, name: &str) -> Option<&SemanticNode>
The first node whose accessible name equals
name, in reading order — the ergonomic handle for a CLI / agent that
addresses elements by label (“focus the node called ‘Volume’”).
pub fn control_paths(&self, control_id: &str) -> Vec<Vec<SemanticId>>
pub fn control_paths(&self, control_id: &str) -> Vec<Vec<SemanticId>>
Every live semantic path to a control binding id, shortest first. Multiple buttons may intentionally bind the same domain action; this gives agents and presence projection a deterministic way to prefer the nearest currently rendered affordance without replacing direct action invocation with simulated clicks.
pub fn action(&self, id: &SemanticId, name: &str) -> Option<&SemanticAction>
pub fn build_prompted(
&self,
id: &SemanticId,
name: &str,
arg: &str,
) -> Option<EncodedAction>
pub fn build_prompted( &self, id: &SemanticId, name: &str, arg: &str, ) -> Option<EncodedAction>
None if (id, name) is not a prompted action.
Trait Implementations§
§impl Default for SemanticTree
impl Default for SemanticTree
§fn default() -> SemanticTree
fn default() -> SemanticTree
Auto Trait Implementations§
impl Freeze for SemanticTree
impl !RefUnwindSafe for SemanticTree
impl !Send for SemanticTree
impl !Sync for SemanticTree
impl Unpin for SemanticTree
impl UnsafeUnpin for SemanticTree
impl !UnwindSafe for SemanticTree
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more