Skip to main content

Semantics

Struct Semantics 

Source
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

Source

pub fn new() -> Annotation

Start with no asserted intent.

Source

pub fn role(self, role: Role) -> Annotation

Set the semantic role.

Source

pub fn name(self, name: impl Into<String>) -> Annotation

Set the accessible name.

Source

pub fn description(self, description: impl Into<String>) -> Annotation

Set the longer description.

Source

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.

Source

pub fn domain( self, key: impl Into<String>, value: impl Into<Value>, ) -> Annotation

Add one application-domain JSON value.

Source

pub fn extended(self, extended: BTreeMap<String, Value>) -> Annotation

Replace the complete application-domain JSON object.

Source

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.

Source

pub fn labelled_by(self, semantic_key: impl Into<String>) -> Annotation

Relate this node to the node carrying semantic_key as its label.

Source

pub fn described_by(self, semantic_key: impl Into<String>) -> Annotation

Relate this node to the node carrying semantic_key as its description.

Source

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

Source§

fn clone(&self) -> Annotation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Annotation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Annotation

Source§

fn default() -> Annotation

Returns the “default value” for a type. Read more
Source§

impl Eq for Annotation

Source§

impl PartialEq for Annotation

Source§

fn eq(&self, other: &Annotation) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Annotation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<W> Annotate for W

Source§

fn annotated(self, semantics: Semantics) -> Annotated<Self>

Pair this widget with author intent without changing its render logic.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.