Skip to main content

Node

Struct Node 

Source
pub struct Node {
Show 19 fields pub id: String, pub parent_id: Option<String>, pub role: Role, pub name: String, pub description: Option<String>, pub value: Option<String>, pub bounds: Option<Rect>, pub state: Option<State>, pub extended: Option<BTreeMap<String, Value>>, pub actions: Option<Vec<Action>>, pub labelled_by: Option<Vec<String>>, pub described_by: Option<Vec<String>>, pub text_ranges: Option<Vec<TextRange>>, pub test_id: Option<String>, pub framework_type: Option<String>, pub occlusion: Option<Occlusion>, pub p: Option<Provenance>, pub px: Option<BTreeMap<String, Provenance>>, pub geometry: Option<NodeGeometryObservations>,
}
Expand description

One accessible node. bounds, when present, are absolute viewport cells.

Fields§

§id: String

Stable identity within the session.

§parent_id: Option<String>

Parent node, or None for a root.

§role: Role

Semantic role from the closed v1 set.

§name: String

Accessible name; empty when the node has none.

§description: Option<String>

Longer description, when one exists.

§value: Option<String>

Current value of a value-bearing node.

§bounds: Option<Rect>

Absolute viewport cells, when the node is painted.

§state: Option<State>

Asserted state flags; unset members are not claims.

§extended: Option<BTreeMap<String, Value>>

Application-defined JSON state, separate from portable state flags.

§actions: Option<Vec<Action>>

Capability hints, never callback endpoints.

§labelled_by: Option<Vec<String>>

Ids of nodes that name this one.

§described_by: Option<Vec<String>>

Ids of nodes that describe this one.

§text_ranges: Option<Vec<TextRange>>

Offset-to-cell mapping for this node’s text.

§test_id: Option<String>

Author-supplied test id.

§framework_type: Option<String>

What the UI framework calls this widget. Required when role is Role::Generic: an unrecognised widget must at least name its own type, so a reader can tell one unknown thing from another.

§occlusion: Option<Occlusion>

Whether the producer can say if these cells are covered by something painted later. Only a producer that observes paint order may say Known; the driver refuses pointer actions on anything else.

§p: Option<Provenance>

Where this node’s facts came from, as a whole.

§px: Option<BTreeMap<String, Provenance>>

Where individual fields came from, when they differ from p.

§geometry: Option<NodeGeometryObservations>

Protocol v2 qualified layout facts; omitted by strict v1 snapshots.

Implementations§

Source§

impl Node

Source

pub fn new(id: impl Into<String>, role: Role, name: impl Into<String>) -> Self

A node with only the required fields set.

Source

pub fn with_framework_type(self, framework_type: impl Into<String>) -> Self

Name what the framework calls this widget, which the protocol requires for a Role::Generic node.

Source

pub fn with_parent(self, parent_id: impl Into<String>) -> Self

Attach this node to a parent.

Source

pub fn with_bounds(self, bounds: Rect) -> Self

Set absolute viewport bounds.

Source

pub fn with_state(self, state: State) -> Self

Set the state flags, dropping them when nothing is asserted.

Source

pub fn with_extended(self, extended: BTreeMap<String, Value>) -> Self

Attach application-defined JSON state.

Source

pub fn with_actions(self, actions: Vec<Action>) -> Self

Declare which actions the node supports.

Source

pub fn with_test_id(self, test_id: impl Into<String>) -> Self

Set the author-supplied test id.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

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 Node

Source§

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

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

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Node

Source§

impl PartialEq for Node

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Node

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
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.