pub struct UiDocument {
pub id: UiDocumentId,
pub revision: u64,
pub placement: UiPlacement,
pub modal: bool,
pub nodes: Vec<UiNode>,
}Expand description
One semantic UI document, independent of a device’s view or graphics APIs.
Fields§
§id: UiDocumentIdStable document identifier.
revision: u64Source and interaction epoch, serialized as a decimal string.
Increment this when the node structure, declared actions, or interaction policy changes. It is not a per-value or per-frame tick; adapters validate input values against the current document state at dispatch time.
placement: UiPlacementRequested spatial placement; adapters never silently replace it.
modal: boolWhether this document captures platform navigation and draws a scrim.
Modal documents prevent scene navigation while active. Modeless documents remain an overlay, so scene controls such as sliders do not hide the scene.
nodes: Vec<UiNode>Flat, deterministic document order for typed UI nodes.
Implementations§
Source§impl UiDocument
impl UiDocument
Sourcepub fn validate(&self) -> Result<(), PresentationError>
pub fn validate(&self) -> Result<(), PresentationError>
Validates document structure and required adapter capabilities.
§Errors
Returns an error for malformed identifiers, bounds, duplicate nodes, or a world placement requested without room tracking.
Sourcepub fn validate_event(
&self,
event: &UiEvent,
) -> Result<ValidatedUiEvent, PresentationError>
pub fn validate_event( &self, event: &UiEvent, ) -> Result<ValidatedUiEvent, PresentationError>
Validates an input event against this exact document revision and node role.
This method checks only the semantic contract. Applying an accepted action remains an application responsibility.
§Errors
Returns an error for stale documents, disabled nodes, mismatched actions, malformed text, or slider values outside the node’s declared range.
Sourcepub fn next_focus(
&self,
current: Option<&UiNodeId>,
direction: UiNavigation,
) -> Option<UiNodeId>
pub fn next_focus( &self, current: Option<&UiNodeId>, direction: UiNavigation, ) -> Option<UiNodeId>
Returns the next enabled focusable node in document order, wrapping at either end.
Trait Implementations§
Source§impl Clone for UiDocument
impl Clone for UiDocument
Source§fn clone(&self) -> UiDocument
fn clone(&self) -> UiDocument
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 UiDocument
impl Debug for UiDocument
Source§impl<'de> Deserialize<'de> for UiDocument
impl<'de> Deserialize<'de> for UiDocument
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 PartialEq for UiDocument
impl PartialEq for UiDocument
Source§fn eq(&self, other: &UiDocument) -> bool
fn eq(&self, other: &UiDocument) -> bool
self and other values to be equal, and is used by ==.