pub struct Annotate<W> { /* private fields */ }Expand description
A wrapper that adds annotation metadata to a widget.
When rendered, the annotation is registered with the current annotation context (if one is active).
§Example
use envision::annotation::{Annotate, Annotation};
use ratatui::widgets::Paragraph;
// Wrap a widget with annotation
let annotated = Annotate::new(
Paragraph::new("Click me"),
Annotation::button("my-button").with_label("My Button"),
);Implementations§
Source§impl<W> Annotate<W>
impl<W> Annotate<W>
Sourcepub fn new(widget: W, annotation: Annotation) -> Self
pub fn new(widget: W, annotation: Annotation) -> Self
Creates a new annotated widget.
Sourcepub fn annotation(&self) -> &Annotation
pub fn annotation(&self) -> &Annotation
Returns a reference to the annotation.
Sourcepub fn annotation_mut(&mut self) -> &mut Annotation
pub fn annotation_mut(&mut self) -> &mut Annotation
Returns a mutable reference to the annotation.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Unwraps and returns the inner widget.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Annotate<W>where
W: Freeze,
impl<W> RefUnwindSafe for Annotate<W>where
W: RefUnwindSafe,
impl<W> Send for Annotate<W>where
W: Send,
impl<W> Sync for Annotate<W>where
W: Sync,
impl<W> Unpin for Annotate<W>where
W: Unpin,
impl<W> UnwindSafe for Annotate<W>where
W: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
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 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>
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