Skip to main content

AccessibilityConfig

Struct AccessibilityConfig 

Source
pub struct AccessibilityConfig<'config> {
    pub parent: Option<ElementId>,
    pub role: Role,
    pub label: OwnedOrRef<'config, str>,
    pub description: OwnedOrRef<'config, str>,
    pub actions: OwnedOrRef<'config, Vec<Action>>,
    pub bounding_box: OwnedOrRef<'config, BoundingBox>,
}
Expand description

Metadata for registering a Cotis element as an AccessKit node.

Use OwnedOrRef fields to pass borrowed strings and bounds per frame or owned values that outlive the registration call.

§Examples

use accesskit::{Action, Role};
use cotis::utils::{ElementId, OwnedOrRef};
use cotis_accessibility::AccessibilityConfig;
use cotis_utils::math::BoundingBox;

let config = AccessibilityConfig {
    parent: None,
    role: Role::Button,
    label: OwnedOrRef::Borrowed("Submit"),
    description: OwnedOrRef::Borrowed(""),
    actions: OwnedOrRef::Borrowed(&vec![Action::Click]),
    bounding_box: OwnedOrRef::Borrowed(&BoundingBox {
        x: 0.0,
        y: 0.0,
        width: 100.0,
        height: 40.0,
    }),
};

Fields§

§parent: Option<ElementId>

Parent element in the accessibility tree, or None for a root node.

§role: Role

Accessibility role (button, text field, etc.).

§label: OwnedOrRef<'config, str>

Primary accessible name for the element.

§description: OwnedOrRef<'config, str>

Secondary description or help text.

§actions: OwnedOrRef<'config, Vec<Action>>

Actions the element supports (click, focus, etc.).

§bounding_box: OwnedOrRef<'config, BoundingBox>

Screen-space bounds in pixels.

Auto Trait Implementations§

§

impl<'config> !RefUnwindSafe for AccessibilityConfig<'config>

§

impl<'config> !UnwindSafe for AccessibilityConfig<'config>

§

impl<'config> Freeze for AccessibilityConfig<'config>

§

impl<'config> Send for AccessibilityConfig<'config>

§

impl<'config> Sync for AccessibilityConfig<'config>

§

impl<'config> Unpin for AccessibilityConfig<'config>

§

impl<'config> UnsafeUnpin for AccessibilityConfig<'config>

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> 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, 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.