Skip to main content

Role

Enum Role 

Source
#[non_exhaustive]
pub enum Role {
Show 56 variants Window, Generic, Group, Region, Navigation, Toolbar, Text, Paragraph, Heading, Image, Link, Button, ToggleButton, CheckBox, RadioButton, RadioGroup, Switch, TextBox, SearchBox, PasswordInput, ComboBox, ListBox, ListOption, Slider, SpinButton, ProgressIndicator, ScrollView, Splitter, Separator, Scrim, List, ListItem, Tree, TreeItem, Table, Grid, Row, Cell, ColumnHeader, RowHeader, TabList, Tab, TabPanel, Menu, MenuBar, MenuItem, MenuItemCheckBox, MenuItemRadio, Dialog, AlertDialog, Tooltip, Status, Alert, Document, Canvas, Unknown,
}
Expand description

The runtime role of a node, carried by trees, YAML, selector strings and the wire.

Display prints the selector name and FromStr parses it back, also accepting AccessKit names as aliases.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Window

A top-level window. Every tree has one per window as its root.

§

Generic

A container with no meaning of its own.

§

Group

A set of related controls.

§

Region

A named landmark section.

§

Navigation

A landmark holding navigation links or controls.

§

Toolbar

A row of controls such as buttons.

§

Text

A run of static text.

§

Paragraph

A paragraph of text.

§

Heading

A heading, with a level.

§

Image

An image.

A link.

§

Button

A button, which may open a popup and so be expandable.

§

ToggleButton

A button that stays pressed or not.

§

CheckBox

A checkbox.

§

RadioButton

One radio button of a group.

§

RadioGroup

A group of radio buttons.

§

Switch

An on and off switch, such as a toggler.

§

TextBox

A text input or editor; multi-line editors have the multiline state.

§

SearchBox

A text input for search terms.

§

PasswordInput

A text input whose value is hidden.

§

ComboBox

A text input with a list of options, such as a pick list or combo box.

§

ListBox

A list of options to pick from.

§

ListOption

One option of a list box. Named so that it does not shadow Option.

§

Slider

A slider over a range of values.

§

SpinButton

A numeric input with step buttons.

§

ProgressIndicator

A progress bar.

§

ScrollView

A scrollable area.

§

Splitter

A focusable separator that resizes the panes either side of it.

§

Separator

A separator that only divides content.

§

Scrim

The layer that blocks the pointer under a dialog or drawer.

§

List

A list.

§

ListItem

One item of a list.

§

Tree

A tree view.

§

TreeItem

One item of a tree view.

§

Table

A table.

§

Grid

An interactive grid.

§

Row

A row of a table, grid or tree grid.

§

Cell

A cell of a table or grid.

§

ColumnHeader

A column header.

§

RowHeader

A row header.

§

TabList

A row of tabs.

§

Tab

One tab.

§

TabPanel

The content shown for a tab.

§

Menu

A menu.

§

MenuBar

A menu bar.

§

MenuItem

A menu item, which may open a submenu.

§

MenuItemCheckBox

A menu item with a checked state.

§

MenuItemRadio

A menu item that is one of a group.

§

Dialog

A dialog.

§

AlertDialog

A dialog that interrupts with an urgent message.

§

Tooltip

A tooltip.

§

Status

A live region with advisory status.

§

Alert

A live region with an important message.

§

Document

A document.

§

Canvas

A canvas.

§

Unknown

A role this version does not know, or none could be given.

Implementations§

Source§

impl Role

Source

pub const ALL: &'static [Role]

Every role, in table order.

Source

pub const fn selector_name(self) -> &'static str

The name used in selector strings, YAML and on the wire, such as button.

Source

pub const fn aria_name(self) -> Option<&'static str>

The ARIA role name, or None where ARIA has no matching role.

Source

pub const fn accesskit_name(self) -> &'static str

The AccessKit role name. A multi-line text box is MultilineTextInput in AccessKit; this returns the single-line name for Role::TextBox.

Source

pub const fn type_name(self) -> &'static str

The name of the variant and of its role type in crate::role, such as Button.

Source

pub const fn capabilities(self) -> Capabilities

The capability traits this role’s type implements.

Source

pub const fn is_click_target(self) -> bool

Whether a click on the node itself is what activates it.

Source§

impl Role

Source

pub const fn is_interactive(self) -> bool

Whether the role is interactive, for audits: a click target, or any capability a person acts through (checking, pressing, expanding, editing, selecting or setting a value).

Source

pub fn from_selector_name(name: &str) -> Option<Role>

The role with this selector name, without AccessKit aliases.

Source

pub fn from_accesskit_name(name: &str) -> Option<Role>

The role with this AccessKit name. Where several roles share one, the first in Role::ALL wins, so GenericContainer is Role::Generic.

Trait Implementations§

Source§

impl Clone for Role

Source§

fn clone(&self) -> Self

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 Copy for Role

Source§

impl Debug for Role

Source§

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

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

impl Display for Role

Source§

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

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

impl Eq for Role

Source§

impl<R: RoleType> From<R> for Role

Source§

fn from(_: R) -> Role

Converts to this type from the input type.
Source§

impl FromStr for Role

Source§

type Err = ParseRoleError

The associated error which can be returned from parsing.
Source§

fn from_str(name: &str) -> Result<Self, ParseRoleError>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Role

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Role

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Role

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Role

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Role

Source§

impl TryFrom<Role> for Window

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Generic

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Group

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Region

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Navigation

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Toolbar

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Text

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Paragraph

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Heading

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Image

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Button

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ToggleButton

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for CheckBox

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for RadioButton

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for RadioGroup

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Switch

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for TextBox

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for PasswordInput

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ComboBox

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ListBox

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ListOption

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Slider

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for SpinButton

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ProgressIndicator

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ScrollView

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Splitter

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Separator

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Scrim

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for List

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ListItem

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Tree

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for TreeItem

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Table

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Grid

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Row

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Cell

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for ColumnHeader

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for RowHeader

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for TabList

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Tab

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for TabPanel

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Menu

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for MenuBar

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for MenuItem

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for MenuItemCheckBox

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for MenuItemRadio

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Dialog

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for AlertDialog

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Tooltip

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Status

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Alert

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Document

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Canvas

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.
Source§

impl TryFrom<Role> for Unknown

Source§

type Error = RoleMismatch

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

fn try_from(role: Role) -> Result<Self, RoleMismatch>

Performs the conversion.

Auto Trait Implementations§

§

impl Forget for Role

§

impl Freeze for Role

§

impl Move for Role

§

impl RefUnwindSafe for Role

§

impl Send for Role

§

impl Sync for Role

§

impl Unpin for Role

§

impl UnsafeUnpin for Role

§

impl UnwindSafe for Role

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.