pub struct Annotation {
pub widget_type: WidgetType,
pub label: Option<String>,
pub id: Option<String>,
pub focused: bool,
pub disabled: bool,
pub selected: bool,
pub expanded: Option<bool>,
pub value: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
Metadata annotation for a widget.
Annotations provide semantic information about widgets that can be used for testing, accessibility, and UI queries.
Fields§
§widget_type: WidgetTypeThe type of widget
label: Option<String>Human-readable label
id: Option<String>Programmatic identifier
focused: boolWhether this widget currently has focus
disabled: boolWhether this widget is disabled
selected: boolWhether this widget is selected (for selectable items)
expanded: Option<bool>Whether this widget is expanded (for collapsible items)
value: Option<String>Current value (for inputs, etc.)
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn new(widget_type: WidgetType) -> Self
pub fn new(widget_type: WidgetType) -> Self
Creates a new annotation with the given widget type.
Creates a button annotation.
Creates a menu item annotation.
Creates a breadcrumb annotation.
Sourcepub fn loading_list(id: impl Into<String>) -> Self
pub fn loading_list(id: impl Into<String>) -> Self
Creates a loading list annotation.
Sourcepub fn multi_progress(id: impl Into<String>) -> Self
pub fn multi_progress(id: impl Into<String>) -> Self
Creates a multi-progress annotation.
Sourcepub fn status_log(id: impl Into<String>) -> Self
pub fn status_log(id: impl Into<String>) -> Self
Creates a status log annotation.
Sourcepub fn title_card(id: impl Into<String>) -> Self
pub fn title_card(id: impl Into<String>) -> Self
Creates a title card annotation.
Sourcepub fn line_input(id: impl Into<String>) -> Self
pub fn line_input(id: impl Into<String>) -> Self
Creates a line input annotation.
Sourcepub fn scrollable_text(id: impl Into<String>) -> Self
pub fn scrollable_text(id: impl Into<String>) -> Self
Creates a scrollable text annotation.
Sourcepub fn split_panel(id: impl Into<String>) -> Self
pub fn split_panel(id: impl Into<String>) -> Self
Creates a split panel annotation.
Sourcepub fn searchable_list(id: impl Into<String>) -> Self
pub fn searchable_list(id: impl Into<String>) -> Self
Creates a searchable list annotation.
Sourcepub fn radio_group(id: impl Into<String>) -> Self
pub fn radio_group(id: impl Into<String>) -> Self
Creates a radio group annotation.
Sourcepub fn file_browser(id: impl Into<String>) -> Self
pub fn file_browser(id: impl Into<String>) -> Self
Creates a file browser annotation.
Sourcepub fn confirm_dialog(title: impl Into<String>) -> Self
pub fn confirm_dialog(title: impl Into<String>) -> Self
Creates a confirm dialog annotation.
Sourcepub fn step_indicator(id: impl Into<String>) -> Self
pub fn step_indicator(id: impl Into<String>) -> Self
Creates a step indicator annotation.
Sourcepub fn styled_text(id: impl Into<String>) -> Self
pub fn styled_text(id: impl Into<String>) -> Self
Creates a styled text annotation.
Sourcepub fn pane_layout(id: impl Into<String>) -> Self
pub fn pane_layout(id: impl Into<String>) -> Self
Creates a pane layout annotation.
Sourcepub fn help_panel(id: impl Into<String>) -> Self
pub fn help_panel(id: impl Into<String>) -> Self
Creates a help panel annotation.
Sourcepub fn command_palette(id: impl Into<String>) -> Self
pub fn command_palette(id: impl Into<String>) -> Self
Creates a command palette annotation.
Sourcepub fn diff_viewer(id: impl Into<String>) -> Self
pub fn diff_viewer(id: impl Into<String>) -> Self
Creates a diff viewer annotation.
Sourcepub fn terminal_output(id: impl Into<String>) -> Self
pub fn terminal_output(id: impl Into<String>) -> Self
Creates a terminal output annotation.
Sourcepub fn custom(type_name: impl Into<String>, id: impl Into<String>) -> Self
pub fn custom(type_name: impl Into<String>, id: impl Into<String>) -> Self
Creates a custom widget annotation.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Sets the label.
Sourcepub fn with_focus(self, focused: bool) -> Self
pub fn with_focus(self, focused: bool) -> Self
Sets the focused state.
Sourcepub fn with_disabled(self, disabled: bool) -> Self
pub fn with_disabled(self, disabled: bool) -> Self
Sets the disabled state.
Sourcepub fn with_selected(self, selected: bool) -> Self
pub fn with_selected(self, selected: bool) -> Self
Sets the selected state.
Sourcepub fn with_expanded(self, expanded: bool) -> Self
pub fn with_expanded(self, expanded: bool) -> Self
Sets the expanded state.
Sourcepub fn with_value(self, value: impl Into<String>) -> Self
pub fn with_value(self, value: impl Into<String>) -> Self
Sets the current value.
Sourcepub fn with_meta(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_meta(self, key: impl Into<String>, value: impl Into<String>) -> Self
Adds metadata.
Sourcepub fn is_type(&self, widget_type: &WidgetType) -> bool
pub fn is_type(&self, widget_type: &WidgetType) -> bool
Returns true if this annotation has the given widget type.
Sourcepub fn is_interactive(&self) -> bool
pub fn is_interactive(&self) -> bool
Returns true if this is an interactive widget.
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Returns a description suitable for display.
Trait Implementations§
Source§impl Clone for Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
1.0.0 · 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§impl<'de> Deserialize<'de> for Annotation
impl<'de> Deserialize<'de> for Annotation
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 Annotation
impl PartialEq for Annotation
Source§impl Serialize for Annotation
impl Serialize for Annotation
impl Eq 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