Skip to main content

Semantics

Struct Semantics 

Source
pub struct Semantics {
Show 24 fields pub role: Role, pub label: Option<String>, pub value: Option<String>, pub actions: ActionSet, pub focusable: bool, pub multiline: bool, pub masked: bool, pub input_mask: Option<InputMask>, pub ime_preedit_range: Option<(usize, usize)>, pub checked: Option<bool>, pub disabled: bool, pub draggable: bool, pub scrollable_x: bool, pub scrollable_y: bool, pub min_value: Option<f32>, pub max_value: Option<f32>, pub current_value: Option<f32>, pub is_focus_scope: bool, pub is_focus_barrier: bool, pub drag_payload: Option<Vec<u8>>, pub hero_tag: Option<String>, pub focus_index: Option<i32>, pub capture_tab: bool, pub auto_indent: bool,
}
Expand description

Accessibility and interaction metadata for a node.

Semantics is the IR’s way of describing what a node means rather than how it looks or where it is positioned. It is consumed by:

  • Assistive technology (screen readers, switch control) via the accessibility tree.
  • The event/focus system, which uses focusable, actions, and disabled to route input.
  • The drag-and-drop subsystem, which reads draggable and drag_payload.

Most fields default to “inert” values (see Default impl), so you only need to set the fields that matter for a given widget.

§Example

use fission_ir::Semantics;
use fission_ir::semantics::Role;

let sem = Semantics {
    role: Role::Button,
    label: Some("Submit".into()),
    focusable: true,
    ..Semantics::default()
};

Fields§

§role: Role

The accessibility role. Defaults to Role::Generic.

§label: Option<String>

A human-readable label for assistive technology (e.g., “Close” for a button).

§value: Option<String>

The current value as a string (e.g., the text in an input field).

§actions: ActionSet

The set of actions this node responds to.

§focusable: bool

Whether this node can receive keyboard focus.

§multiline: bool

Whether this text input supports multiple lines.

§masked: bool

Whether the value should be obscured (password fields).

§input_mask: Option<InputMask>

An optional input mask that restricts which characters are accepted.

§ime_preedit_range: Option<(usize, usize)>

The byte range of IME pre-edit (composition) text, if any.

§checked: Option<bool>

For checkboxes and switches: Some(true) = checked, Some(false) = unchecked, None = not a toggle.

§disabled: bool

Whether the node is disabled (grayed out, non-interactive).

§draggable: bool

Whether this node can be dragged.

§scrollable_x: bool

Whether the node scrolls horizontally.

§scrollable_y: bool

Whether the node scrolls vertically.

§min_value: Option<f32>

Minimum value for range inputs (sliders).

§max_value: Option<f32>

Maximum value for range inputs (sliders).

§current_value: Option<f32>

Current numeric value for range inputs (sliders).

§is_focus_scope: bool

When true, this node creates a new focus scope (like a dialog or panel).

§is_focus_barrier: bool

When true, Tab traversal does not leave this subtree.

§drag_payload: Option<Vec<u8>>

Serialized payload attached to a drag operation.

§hero_tag: Option<String>

An identifier for hero/shared-element transitions.

§focus_index: Option<i32>

Explicit tab order index. Lower values receive focus first. None means the node follows document order.

§capture_tab: bool

When true, Tab key inserts spaces instead of moving focus.

§auto_indent: bool

When true, Enter copies leading whitespace from the current line.

Trait Implementations§

Source§

impl Clone for Semantics

Source§

fn clone(&self) -> Semantics

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Semantics

Source§

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

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

impl Default for Semantics

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Semantics

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 Hash for Semantics

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

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Semantics

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 Semantics

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,