pub struct SemanticsSpec {
pub role: Option<Role>,
pub label: Option<Arc<str>>,
pub description: Option<Arc<str>>,
pub value: Option<Arc<str>>,
pub flags: SemanticsFlags,
}Expand description
Especificación semántica completa de un nodo. Lo que el runtime traduce a
un accesskit::Node cada frame.
label es lo que el lector enuncia primero (el “nombre accesible”). Si el
nodo ya tiene un text visible y significativo, podés dejar label = None
y el runtime usará ese texto como nombre — pero declararlo explícito es más
robusto (e.g. un botón con sólo un ícono necesita label porque no hay texto
visible).
value es el dato dinámico (texto del input, valor del slider). El lector
suele leer label + value juntos: “Volumen, 70”.
description es contexto adicional (“Disminuye el volumen del sistema”).
Los lectores lo leen tras una pausa o con un atajo distinto; usalo para
info que ayude PERO no sobreloadées (los usuarios de TTS perciben ruido
más que falta de info).
Fields§
§role: Option<Role>§label: Option<Arc<str>>§description: Option<Arc<str>>§value: Option<Arc<str>>§flags: SemanticsFlagsImplementations§
Source§impl SemanticsSpec
impl SemanticsSpec
Sourcepub fn role(role: Role) -> Self
pub fn role(role: Role) -> Self
Especificación con sólo el rol fijado. Atajo común; los demás campos
quedan None y los flags vacíos.
Sourcepub fn with_label(self, s: impl Into<Arc<str>>) -> Self
pub fn with_label(self, s: impl Into<Arc<str>>) -> Self
Pone label (consumiendo cualquier valor previo).
Sourcepub fn with_description(self, s: impl Into<Arc<str>>) -> Self
pub fn with_description(self, s: impl Into<Arc<str>>) -> Self
Pone description.
Sourcepub fn with_value(self, s: impl Into<Arc<str>>) -> Self
pub fn with_value(self, s: impl Into<Arc<str>>) -> Self
Pone value.
Sourcepub fn with_checked(self, v: bool) -> Self
pub fn with_checked(self, v: bool) -> Self
Pone flags.checked = Some(v).
pub fn with_pressed(self, v: bool) -> Self
pub fn with_expanded(self, v: bool) -> Self
pub fn with_disabled(self, v: bool) -> Self
pub fn with_readonly(self, v: bool) -> Self
pub fn with_required(self, v: bool) -> Self
Trait Implementations§
Source§impl Clone for SemanticsSpec
impl Clone for SemanticsSpec
Source§fn clone(&self) -> SemanticsSpec
fn clone(&self) -> SemanticsSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SemanticsSpec
impl Debug for SemanticsSpec
Source§impl Default for SemanticsSpec
impl Default for SemanticsSpec
Source§fn default() -> SemanticsSpec
fn default() -> SemanticsSpec
Source§impl PartialEq for SemanticsSpec
impl PartialEq for SemanticsSpec
Source§fn eq(&self, other: &SemanticsSpec) -> bool
fn eq(&self, other: &SemanticsSpec) -> bool
self and other values to be equal, and is used by ==.