Skip to main content

View

Struct View 

Source
pub struct View {
    pub content: String,
    pub on_mouse: Option<OnMouseFn>,
    pub cursor: Option<Cursor>,
    pub background_color: Option<Color>,
    pub foreground_color: Option<Color>,
    pub window_title: String,
    pub alt_screen: bool,
    pub report_focus: bool,
    pub disable_bracketed_paste_mode: bool,
    pub mouse_mode: MouseMode,
    pub keyboard_enhancements: KeyboardEnhancements,
    pub progress_bar: Option<ProgressBar>,
}
Expand description

View represents a declarative terminal view in Bubble Tea v2.0.8.

Fields§

§content: String

Screen content formatted string.

§on_mouse: Option<OnMouseFn>

Optional mouse event interceptor.

§cursor: Option<Cursor>

Optional cursor configuration.

§background_color: Option<Color>

Optional background color.

§foreground_color: Option<Color>

Optional foreground color.

§window_title: String

Window title string.

§alt_screen: bool

Alternate screen buffer toggle.

§report_focus: bool

Focus reporting toggle.

§disable_bracketed_paste_mode: bool

Disable bracketed paste mode toggle.

§mouse_mode: MouseMode

Mouse tracking mode.

§keyboard_enhancements: KeyboardEnhancements

Keyboard enhancements requested.

§progress_bar: Option<ProgressBar>

Optional terminal progress bar.

Implementations§

Source§

impl View

Source

pub fn new(content: &str) -> Self

NewView is a helper function to create a new View with the given styled string. A styled string represents text with styles and hyperlinks encoded as ANSI escape codes.

v := tea.NewView("Hello, World!")
```</upstream-comment>
Source

pub fn set_content(&mut self, s: &str)

Helper method to set view content.

Source§

impl View

Source

pub fn equals(&self, o: &View) -> bool

Returns whether two views are equivalent for rendering purposes, mirroring the upstream viewEquals check used to skip re-renders.

Trait Implementations§

Source§

impl Clone for View

Source§

fn clone(&self) -> View

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 Default for View

Source§

fn default() -> Self

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

impl PartialEq for View

Source§

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

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

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for View

§

impl !UnwindSafe for View

§

impl Freeze for View

§

impl Send for View

§

impl Sync for View

§

impl Unpin for View

§

impl UnsafeUnpin for View

Blanket Implementations§

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<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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.