Skip to main content

PlacedSemanticsNode

Struct PlacedSemanticsNode 

Source
pub struct PlacedSemanticsNode {
    pub node_id: NodeId,
    pub role: SemanticsRole,
    pub widget_role: Option<SemanticsWidgetRole>,
    pub label: Option<String>,
    pub state_description: Option<String>,
    pub clickable: bool,
    pub toggled: Option<bool>,
    pub enabled: bool,
    pub layout_bounds: Rect,
    pub touch_bounds: Option<Rect>,
    pub children: Vec<PlacedSemanticsNode>,
}
Expand description

One semantics node, with the geometry it was placed and drawn at.

Field-for-field a subset of SemanticsNode plus the two boxes; the fields that are dropped are the ones a geometry audit has no use for (custom actions, text selection, the canvas children a drawn control publishes — those already carry their own bounds).

Fields§

§node_id: NodeId§role: SemanticsRole

Where the node sits in the tree: layout, text, subcomposition …

§widget_role: Option<SemanticsWidgetRole>

What a screen reader announces it as — Compose’s Role.

§label: Option<String>

The text of a Text node, or the content description of anything else.

§state_description: Option<String>§clickable: bool

Whether the node carries a click action, which is what separates a control from something merely described.

§toggled: Option<bool>§enabled: bool§layout_bounds: Rect

The box the measure pass gave this node, in window coordinates.

§touch_bounds: Option<Rect>

The box the renderer draws and the hit test inverts, ancestor graphics layers included. None when the hit graph carries no region for it.

§children: Vec<PlacedSemanticsNode>

Implementations§

Source§

impl PlacedSemanticsNode

Source

pub fn target_bounds(&self) -> Rect

The box a finger has to find: the drawn quad where there is one, and the layout box where the node is not a hit target at all.

Source

pub fn visit(&self, visitor: &mut impl FnMut(&PlacedSemanticsNode))

Depth-first walk, self first.

Source

pub fn flatten(&self) -> Vec<&PlacedSemanticsNode>

Every node in the subtree, self first, in tree order.

Source

pub fn controls(&self) -> Vec<&PlacedSemanticsNode>

Every node a tap would do something to.

Source

pub fn describe(&self) -> String

A name for an assertion message: the label if there is one, else the role and the node id, which at least says which one it was.

Trait Implementations§

Source§

impl Clone for PlacedSemanticsNode

Source§

fn clone(&self) -> PlacedSemanticsNode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlacedSemanticsNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PlacedSemanticsNode

Source§

fn eq(&self, other: &PlacedSemanticsNode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlacedSemanticsNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.