Skip to main content

StateSet

Struct StateSet 

Source
#[non_exhaustive]
pub struct StateSet {
Show 15 fields pub enabled: bool, pub visible: bool, pub focused: bool, pub active: bool, pub minimized: Option<bool>, pub maximized: Option<bool>, pub fullscreen: Option<bool>, pub checked: Option<Toggled>, pub selected: bool, pub expanded: Option<bool>, pub editable: bool, pub focusable: bool, pub modal: bool, pub required: bool, pub busy: bool,
}
Expand description

Boolean state flags for an element.

Semantics for non-applicable states: When a state doesn’t apply to an element’s role, the backend uses the platform’s reported value or defaults:

  • enabled: true (elements are enabled unless explicitly disabled)
  • visible: true (elements are visible unless explicitly hidden/offscreen)
  • focused, active, focusable, modal, selected, editable, required, busy: false

States that are inherently inapplicable use Option: checked is None for non-checkable elements, expanded is None for non-expandable elements. The window states (minimized, maximized, fullscreen) are Option for a second reason: None also means unknown — a platform that cannot read the state reports None rather than a guessed false (Linux cannot report maximized or fullscreen at all, and Windows cannot report fullscreen).

#[non_exhaustive]: more states arrive in compatible releases and must not break readers. Providers building a complete state set use [StateParts], which is exhaustive — the documented defaults above are what a partial construction falls back to, not a licence for a backend to skip deciding.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§enabled: bool§visible: bool§focused: bool§active: bool

Whether this element is the active (foreground) window — the window that currently receives the user’s input. Only meaningful for window-like elements (windows, dialogs); false elsewhere. Distinct from focused, which is element-level keyboard focus. Platform mappings: the AT-SPI ACTIVE state (Linux), AXMain (macOS), and the foreground HWND (Windows).

§minimized: Option<bool>

Whether the window is minimized (iconified).

None = unknown or not a window. Unlike enabled/visible, the three window states are Option<bool> because None also means “this platform cannot report the state”: Linux cannot read maximized or fullscreen at all, and Windows cannot read fullscreen (it reads minimized and maximized from WindowPattern.CurrentWindowVisualState), so a hard-coded false would be a silent guess.

§maximized: Option<bool>

Whether the window is maximized. None = unknown / not a window.

§fullscreen: Option<bool>

Whether the window is in fullscreen. None = unknown / not a window.

§checked: Option<Toggled>

None = not checkable

§selected: bool§expanded: Option<bool>

None = not expandable

§editable: bool§focusable: bool

Whether the element can receive keyboard focus

§modal: bool

Whether the element is a modal dialog

§required: bool

Form field required

§busy: bool

Async operation in progress

Trait Implementations§

Source§

impl Clone for StateSet

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 Debug for StateSet

Source§

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

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

impl Default for StateSet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StateSet

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 PartialEq for StateSet

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 Serialize for StateSet

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 StateSet

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> 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> 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 = !

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.