pub struct SemanticsRegion {
pub id: Option<NodeId>,
pub identifier: Option<String>,
pub label: Option<String>,
pub role: Role,
pub actions: ActionSet,
pub child: Option<Box<Node>>,
}Expand description
Wraps a subtree in an explicit semantics node.
Use SemanticsRegion when a shell or renderer needs a stable semantic
target around an otherwise normal widget subtree. For example, the server
shell uses semantic regions as mount points for focused browser islands.
Fields§
§id: Option<NodeId>Explicit node identity for the region.
identifier: Option<String>Stable semantic identifier exposed to renderers and shell adapters.
label: Option<String>Optional accessible label for the region.
role: RoleSemantic role. Defaults to a generic region.
actions: ActionSetActions attached to the semantic region.
child: Option<Box<Node>>Wrapped child subtree.
Implementations§
Source§impl SemanticsRegion
impl SemanticsRegion
Sourcepub fn new(child: Node) -> Self
pub fn new(child: Node) -> Self
Creates a semantic wrapper around an existing child node.
Use builder methods to add a stable identifier, accessible label, role,
or action metadata before converting the region back into a Node.
Sourcepub fn id(self, id: NodeId) -> Self
pub fn id(self, id: NodeId) -> Self
Sets an explicit node id for the region.
This is useful when generated browser artifacts need to send actions back to a known mount point. Prefer leaving it unset unless the shell or renderer requires a stable id.
Sourcepub fn identifier(self, identifier: impl Into<String>) -> Self
pub fn identifier(self, identifier: impl Into<String>) -> Self
Sets the semantic identifier exposed to shells and HTML renderers.
Identifiers are intended to be stable within a route. They are used by tests, accessibility bridges, and progressive enhancement code to find the right semantic region without depending on generated DOM structure.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Sets the accessible label for the semantic region.
Use this when the wrapped child does not already expose enough text for assistive technologies to describe the region or control clearly.
Sourcepub fn role(self, role: Role) -> Self
pub fn role(self, role: Role) -> Self
Sets the semantic role of the region.
Choose the role that matches the user-visible behavior of the wrapped
child. For example, a styled region that behaves like a button should use
Role::Button and expose a default action.
Sourcepub fn default_action(self, action: ActionEnvelope) -> Self
pub fn default_action(self, action: ActionEnvelope) -> Self
Attaches the action that should run when the region is activated.
This is the semantic equivalent of a button press. It lets renderers expose activation consistently across mouse, keyboard, accessibility, and browser-island event paths.
Trait Implementations§
Source§impl Clone for SemanticsRegion
impl Clone for SemanticsRegion
Source§fn clone(&self) -> SemanticsRegion
fn clone(&self) -> SemanticsRegion
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 SemanticsRegion
impl Debug for SemanticsRegion
Source§impl Default for SemanticsRegion
impl Default for SemanticsRegion
Source§impl<'de> Deserialize<'de> for SemanticsRegion
impl<'de> Deserialize<'de> for SemanticsRegion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<SemanticsRegion> for Node
impl From<SemanticsRegion> for Node
Source§fn from(w: SemanticsRegion) -> Self
fn from(w: SemanticsRegion) -> Self
Source§impl Lower for SemanticsRegion
impl Lower for SemanticsRegion
Source§fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
Auto Trait Implementations§
impl Freeze for SemanticsRegion
impl !RefUnwindSafe for SemanticsRegion
impl Send for SemanticsRegion
impl Sync for SemanticsRegion
impl Unpin for SemanticsRegion
impl UnsafeUnpin for SemanticsRegion
impl !UnwindSafe for SemanticsRegion
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
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.