pub struct Semantics {
pub role: Option<Role>,
pub name: Option<String>,
pub description: Option<String>,
pub test_id: Option<String>,
pub extended: BTreeMap<String, Value>,
pub actions: Vec<Action>,
pub labelled_by: Vec<String>,
pub described_by: Vec<String>,
pub semantic_key: Option<String>,
}Expand description
Author intent attached to one immediate-mode render call.
This type deliberately cannot carry bounds, focus, visibility, cells or
collection state. Those facts belong to the framework and the terminal.
Its actions are descriptive members of the protocol’s closed vocabulary,
not callbacks. extended is application-domain JSON only; keys that happen
to be named bounds, state or actions remain nested domain data and are
never promoted into protocol fields.
Fields§
§role: Option<Role>Semantic role chosen by the application author.
name: Option<String>Accessible name chosen by the application author.
description: Option<String>Longer author description.
test_id: Option<String>Stable selector/correlation hint. Never promoted to node identity.
extended: BTreeMap<String, Value>Explicit application-domain JSON state.
actions: Vec<Action>Descriptive protocol actions. They are capability hints, never callbacks.
labelled_by: Vec<String>Semantic keys of nodes that label this node in the same frame.
described_by: Vec<String>Semantic keys of nodes that describe this node in the same frame.
semantic_key: Option<String>Author-owned identity for a value recreated on every frame.
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn new() -> Annotation
pub fn new() -> Annotation
Start with no asserted intent.
Sourcepub fn role(self, role: Role) -> Annotation
pub fn role(self, role: Role) -> Annotation
Set the semantic role.
Sourcepub fn name(self, name: impl Into<String>) -> Annotation
pub fn name(self, name: impl Into<String>) -> Annotation
Set the accessible name.
Sourcepub fn description(self, description: impl Into<String>) -> Annotation
pub fn description(self, description: impl Into<String>) -> Annotation
Set the longer description.
Sourcepub fn test_id(self, test_id: impl Into<String>) -> Annotation
pub fn test_id(self, test_id: impl Into<String>) -> Annotation
Set the stable selector/correlation hint.
Ratatui still has frame-local identity. The value becomes testId, so
locators may use it and consumers may correlate deliberately, but the
node id and handshake remain frame-local.
Sourcepub fn domain(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Annotation
pub fn domain( self, key: impl Into<String>, value: impl Into<Value>, ) -> Annotation
Add one application-domain JSON value.
Sourcepub fn extended(self, extended: BTreeMap<String, Value>) -> Annotation
pub fn extended(self, extended: BTreeMap<String, Value>) -> Annotation
Replace the complete application-domain JSON object.
Sourcepub fn action(self, action: Action) -> Annotation
pub fn action(self, action: Action) -> Annotation
Add one descriptive action from the protocol’s closed vocabulary.
The driver still performs the corresponding real terminal input; this never registers or invokes an application callback.
Sourcepub fn labelled_by(self, semantic_key: impl Into<String>) -> Annotation
pub fn labelled_by(self, semantic_key: impl Into<String>) -> Annotation
Relate this node to the node carrying semantic_key as its label.
Sourcepub fn described_by(self, semantic_key: impl Into<String>) -> Annotation
pub fn described_by(self, semantic_key: impl Into<String>) -> Annotation
Relate this node to the node carrying semantic_key as its description.
Sourcepub fn semantic_key(self, semantic_key: impl Into<String>) -> Annotation
pub fn semantic_key(self, semantic_key: impl Into<String>) -> Annotation
Give this annotated render call stable author-owned identity.
A key must be unique among the frame’s annotated widgets. Duplicate or empty keys safely degrade to frame-local ids rather than invalidating the snapshot or picking a winner by render order.
Trait Implementations§
Source§impl Clone for Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
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 Annotation
impl Debug for Annotation
Source§impl Default for Annotation
impl Default for Annotation
Source§fn default() -> Annotation
fn default() -> Annotation
impl Eq for Annotation
Source§impl PartialEq for Annotation
impl PartialEq for Annotation
impl StructuralPartialEq for Annotation
Auto Trait Implementations§
impl Freeze for Annotation
impl RefUnwindSafe for Annotation
impl Send for Annotation
impl Sync for Annotation
impl Unpin for Annotation
impl UnsafeUnpin for Annotation
impl UnwindSafe for Annotation
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more