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) -> SemanticsSpec
pub fn role(role: Role) -> SemanticsSpec
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>>) -> SemanticsSpec
pub fn with_label(self, s: impl Into<Arc<str>>) -> SemanticsSpec
Pone label (consumiendo cualquier valor previo).
Sourcepub fn with_description(self, s: impl Into<Arc<str>>) -> SemanticsSpec
pub fn with_description(self, s: impl Into<Arc<str>>) -> SemanticsSpec
Pone description.
Sourcepub fn with_value(self, s: impl Into<Arc<str>>) -> SemanticsSpec
pub fn with_value(self, s: impl Into<Arc<str>>) -> SemanticsSpec
Pone value.
Sourcepub fn with_checked(self, v: bool) -> SemanticsSpec
pub fn with_checked(self, v: bool) -> SemanticsSpec
Pone flags.checked = Some(v).
pub fn with_pressed(self, v: bool) -> SemanticsSpec
pub fn with_expanded(self, v: bool) -> SemanticsSpec
pub fn with_disabled(self, v: bool) -> SemanticsSpec
pub fn with_readonly(self, v: bool) -> SemanticsSpec
pub fn with_required(self, v: bool) -> SemanticsSpec
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 ==.impl StructuralPartialEq for SemanticsSpec
Auto Trait Implementations§
impl Freeze for SemanticsSpec
impl RefUnwindSafe for SemanticsSpec
impl Send for SemanticsSpec
impl Sync for SemanticsSpec
impl Unpin for SemanticsSpec
impl UnsafeUnpin for SemanticsSpec
impl UnwindSafe for SemanticsSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.