### ScrollBar Configuration Examples Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollBar.html Examples demonstrating how to configure ScrollBar properties like offset, track click behavior, and arrow endcaps. ```APIDOC ## ScrollBar Configuration Examples ### Setting Offset ```rust use tui_scrollbar::{ScrollBar, ScrollLengths}; let area = Rect::new(0, 0, 1, 5); let lengths = ScrollLengths { content_len: 200, viewport_len: 40, }; let scrollbar = ScrollBar::vertical(lengths).offset(60); ``` ### Track Click Behavior ```rust use tui_scrollbar::{ScrollBar, ScrollLengths, TrackClickBehavior}; let lengths = ScrollLengths { content_len: 10, viewport_len: 5, }; let scrollbar = ScrollBar::vertical(lengths).track_click_behavior(TrackClickBehavior::JumpToClick); ``` ### Arrow Endcaps ```rust use tui_scrollbar::{ScrollBar, ScrollBarArrows, ScrollLengths}; let lengths = ScrollLengths { content_len: 120, viewport_len: 24, }; let scrollbar = ScrollBar::vertical(lengths).arrows(ScrollBarArrows::Both); ``` ``` -------------------------------- ### Install ratatui and tui-big-text Source: https://docs.rs/tui-widgets/latest/tui_widgets/big_text/index.html Add the ratatui and tui-big-text crates to your project dependencies. ```bash cargo add ratatui tui-big-text ``` -------------------------------- ### Install tui-prompts Crate Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/index.html Add the ratatui, tui-prompts, and crossterm crates to your project dependencies. ```bash cargo add ratatui tui-prompts crossterm ``` -------------------------------- ### Run Card Widget Demo Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/index.html Execute the example provided with the crate to see the card widget in action. This requires the `cargo` command-line tool. ```bash cargo run --example card ``` -------------------------------- ### BigText Widget Usage Example Source: https://docs.rs/tui-widgets/latest/tui_widgets/big_text/struct.BigText.html Demonstrates how to create and configure a BigText widget using its builder. Customize pixel size, style, and lines of text. ```rust use ratatui::prelude::*; use tui_big_text::{BigText, PixelSize}; BigText::builder() .pixel_size(PixelSize::Full) .style(Style::new().white()) .lines(vec![ "Hello".red().into(), "World".blue().into(), "=====".into(), ]) .build(); ``` -------------------------------- ### Create and Render a Card Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.Card.html Example of creating a new Card instance and rendering it using a frame. Requires importing Card, Rank, and Suit. ```rust use tui_cards::{Card, Rank, Suit}; let card = Card::new(Rank::Ace, Suit::Spades); frame.render_widget(&card, frame.area()); ``` -------------------------------- ### Popup Configuration Example Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html Demonstrates how to create and configure a Popup widget with custom title, style, and border settings. This is useful for creating interactive dialogs or informational popups. ```rust use ratatui::prelude::*; use ratatui::symbols::border; use tui_popup::Popup; fn render_popup(frame: &mut Frame) { let popup = Popup::new("Press any key to exit") .title("tui-popup demo") .style(Style::new().white().on_blue()) .border_set(border::ROUNDED) .border_style(Style::new().bold()); frame.render_widget(popup, frame.area()); } ``` -------------------------------- ### Install tui-bar-graph Widget Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/index.html Add the ratatui and tui-bar-graph crates to your project dependencies using Cargo. ```bash cargo add ratatui tui-bar-graph ``` -------------------------------- ### Install tui-popup Crate Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/index.html Add the tui-popup crate to your project dependencies using Cargo. ```bash cargo add tui-popup ``` -------------------------------- ### Render QR Code in Ratatui Terminal Source: https://docs.rs/tui-widgets/latest/tui_widgets/qrcode/index.html This example demonstrates how to initialize a Ratatui terminal, run an event loop, and render a QR code widget. The QR code is generated for 'https://ratatui.rs' and displayed with inverted colors. The loop breaks on any key press. ```rust use qrcode::QrCode; use ratatui::crossterm::event; use ratatui::{DefaultTerminal, Frame}; use tui_qrcode::{Colors, QrCodeWidget}; fn main() -> color_eyre::Result<()> { color_eyre::install()?; let terminal = ratatui::init(); let result = run(terminal); ratatui::restore(); result } fn run(mut terminal: DefaultTerminal) -> color_eyre::Result<()> { loop { terminal.draw(render)?; if matches!(event::read()?, event::Event::Key(_)) { break Ok(()) } } } fn render(frame: &mut Frame) { let qr_code = QrCode::new("https://ratatui.rs").expect("failed to create QR code"); let widget = QrCodeWidget::new(qr_code).colors(Colors::Inverted); frame.render_widget(widget, frame.area()); } ``` -------------------------------- ### Install tui-scrollbar Crate Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/index.html Add the tui-scrollbar crate to your project dependencies using Cargo. ```bash cargo add tui-scrollbar ``` -------------------------------- ### Implement a Scrollable Widget Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollview/index.html This example demonstrates how to create a custom scrollable widget using ScrollView and ScrollViewState. It includes rendering multiple paragraphs within the scrollable area. ```rust use std::iter; use ratatui::layout::Size; use ratatui::prelude::*; use ratatui::widgets::*; use tui_scrollview::{ScrollView, ScrollViewState}; struct MyScrollableWidget; impl StatefulWidget for MyScrollableWidget { type State = ScrollViewState; fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) { // 100 lines of text let line_numbers = (1..=100).map(|i| format!({"%3} ", i)).collect::(); let content = iter::repeat("Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n") .take(100) .collect::(); let content_size = Size::new(100, 30); let mut scroll_view = ScrollView::new(content_size); // the layout doesn't have to be hardcoded like this, this is just an example scroll_view.render_widget(Paragraph::new(line_numbers), Rect::new(0, 0, 5, 100)); scroll_view.render_widget(Paragraph::new(content), Rect::new(5, 0, 95, 100)); scroll_view.render(buf.area, buf, state); } } ``` -------------------------------- ### State::value Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets the value of the prompt. ```APIDOC ## State::value ### Description Gets the value of the prompt. ### Method `fn value(&self) -> &str` ### Returns The current value of the prompt as a string slice. ``` -------------------------------- ### Add qrcode and tui-qrcode to Cargo.toml Source: https://docs.rs/tui-widgets/latest/tui_widgets/qrcode/index.html Install the qrcode and tui-qrcode crates. Disable default features of qrcode to avoid unnecessary image rendering code. ```bash cargo add qrcode tui-qrcode --no-default-features ``` -------------------------------- ### BarStyle::Solid Example Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/enum.BarStyle.html Renders bars using the full block character ‘█’. This provides a solid and opaque bar representation. ```rust /// Render bars using the full block character ‘`█`’. ``` -------------------------------- ### Move Cursor to Start of TextState Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Moves the cursor to the beginning of the TextState's value. This is a common navigation shortcut. ```rust fn move_start(&mut self) ``` -------------------------------- ### Render QrCodeWidget with Customizations Source: https://docs.rs/tui-widgets/latest/tui_widgets/qrcode/struct.QrCodeWidget.html Renders a QrCodeWidget within a Ratatui frame, applying customizations for quiet zone, scaling, and colors. This example demonstrates combining multiple styling options. ```rust use qrcode::QrCode; use ratatui::style::{Style, Stylize}; use ratatui::Frame; use tui_qrcode::{Colors, QrCodeWidget, QuietZone, Scaling}; fn render(frame: &mut Frame) { let qr_code = QrCode::new("https://ratatui.rs").expect("failed to create QR code"); let widget = QrCodeWidget::new(qr_code) .quiet_zone(QuietZone::Disabled) .scaling(Scaling::Max) .colors(Colors::Inverted) .red() .on_light_yellow(); frame.render_widget(widget, frame.area()); } ``` -------------------------------- ### Get Thumb Start Position in Subcells Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the thumb start position in subcells. ```rust pub const fn thumb_start(&self) -> usize ``` -------------------------------- ### Convert Thumb Start to Offset Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Converts a thumb start position (in subcells) to an offset (in subcells). Thumb positions beyond the end of travel are clamped to the maximum offset. ```rust pub fn offset_for_thumb_start(&self, thumb_start: usize) -> usize ``` -------------------------------- ### Convert Offset to Thumb Start Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Converts an offset (in subcells) to a thumb start position (in subcells). Larger offsets move the thumb toward the end of the track, clamped to the maximum travel. ```rust pub fn thumb_start_for_offset(&self, offset: usize) -> usize ``` -------------------------------- ### BarStyle::Quadrant Example Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/enum.BarStyle.html Renders bars using quadrant block characters for a more granular representation. These characters allow for finer detail in bar visualization. ```rust /// Render bars using quadrant block characters for a more granular representation. ``` -------------------------------- ### BarStyle::Braille Example Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/enum.BarStyle.html Renders bars using braille characters for a more granular representation. Braille characters offer high granularity and are widely supported by fonts. ```rust /// Render bars using braille characters for a more granular representation. ``` -------------------------------- ### Initialize and Render ScrollView Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollview/struct.ScrollView.html Demonstrates creating a ScrollView, rendering widgets into its buffer, and then rendering the visible portion of the ScrollView into the main buffer. Includes programmatic scrolling and state management. ```rust use ratatui::{prelude::*, layout::Size, widgets::*}; use tui_scrollview::{ScrollView, ScrollViewState}; let mut scroll_view = ScrollView::new(Size::new(20, 20)); // render a few widgets into the buffer at various positions scroll_view.render_widget(Paragraph::new("Hello, world!"), Rect::new(0, 0, 20, 1)); scroll_view.render_widget(Paragraph::new("Hello, world!"), Rect::new(10, 10, 20, 1)); scroll_view.render_widget(Paragraph::new("Hello, world!"), Rect::new(15, 15, 20, 1)); // You can also render widgets into the buffer programmatically Line::raw("Hello, world!").render(Rect::new(0, 0, 20, 1), scroll_view.buf_mut()); // usually you would store the state of the scroll view in a struct that implements // StatefulWidget (or in your app state if you're using an `App` struct) let mut state = ScrollViewState::default(); // you can also scroll the view programmatically state.scroll_down(); // render the scroll view into the main buffer at the given position within a widget let scroll_view_area = Rect::new(0, 0, 10, 10); scroll_view.render(scroll_view_area, buf, &mut state); // or if you're rendering in a terminal draw closure instead of from within another widget: frame.render_stateful_widget(scroll_view, frame.size(), state); ``` -------------------------------- ### get Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.RankIter.html Returns an iterator over a subsection of the iterator. ```APIDOC ## get ### Description Returns an iterator over a subsection of the iterator. ### Signature `fn get(self, index: R) -> >::Output` ### Constraints - `Self: Sized` - `R: IteratorIndex` ``` -------------------------------- ### Rank template Implementation Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Rank.html Provides a method to get a string template for each Rank variant. This can be used for formatting or display purposes. ```rust pub const fn template(self) -> &'static str ``` -------------------------------- ### Get TextState Focus Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Returns the current focus state of the prompt. The focus state indicates whether the prompt is currently selected. ```rust fn focus_state(&self) -> FocusState ``` -------------------------------- ### get Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.SuitIter.html Returns an iterator over a subsection of the iterator. ```APIDOC ## fn get(self, index: R) -> >::Output ### Description Returns an iterator over a subsection of the iterator. ### Method `get` ### Parameters - `index` (R): An index type that implements `IteratorIndex`. ### Response - `>::Output`: An iterator over the specified subsection. ``` -------------------------------- ### Get TextState Value Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Returns the current string value of the prompt. This is an immutable reference to the prompt's text. ```rust fn value(&self) -> &str ``` -------------------------------- ### State::status Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets the status of the prompt. ```APIDOC ## State::status ### Description Gets the status of the prompt. ### Method `fn status(&self) -> Status` ### Returns The current `Status` of the prompt. ``` -------------------------------- ### State::cursor Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets the cursor position of the prompt. ```APIDOC ## State::cursor ### Description Gets the cursor position of the prompt. ### Method `fn cursor(&self) -> (u16, u16)` ### Returns The cursor position as a tuple of `(u16, u16)`. ``` -------------------------------- ### State::move_start Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Moves the cursor to the beginning of the prompt. ```APIDOC ## State::move_start ### Description Moves the cursor to the beginning of the prompt. ### Method `fn move_start(&mut self)` ``` -------------------------------- ### State::position Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets the position of the cursor in the prompt. ```APIDOC ## State::position ### Description Gets the position of the cursor in the prompt. ### Method `fn position(&self) -> usize` ### Returns The cursor position as a `usize`. ``` -------------------------------- ### State::focus_state Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets the focus state of the prompt. ```APIDOC ## State::focus_state ### Description Gets the focus state of the prompt. ### Method `fn focus_state(&self) -> FocusState` ### Returns The current `FocusState` of the prompt. ``` -------------------------------- ### BarGraph Creation and Configuration Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/struct.BarGraph.html Demonstrates how to create a BarGraph widget with initial data and configure its appearance using various builder methods. ```APIDOC ## BarGraph A widget for displaying a bar graph. ### Example ```rust use tui_bar_graph::{BarGraph, BarStyle, ColorMode}; let data = vec![0.0, 0.1, 0.2, 0.3, 0.4, 0.5]; let bar_graph = BarGraph::new(data) .with_gradient(colorgrad::preset::turbo()) .with_bar_style(BarStyle::Braille) .with_color_mode(ColorMode::VerticalGradient); // frame.render_widget(bar_graph, area); ``` ### Methods #### `new(data: Vec) -> BarGraph<'g>` Creates a new bar graph with the given data. #### `with_gradient(self, gradient: impl Gradient + 'g) -> BarGraph<'g>` Sets the gradient to use for coloring the bars. #### `with_max(self, max: impl Into>) -> BarGraph<'g>` Sets the maximum value to display. Values greater than this will be clamped to this value. If `None`, the maximum value is calculated from the data. #### `with_min(self, min: impl Into>) -> BarGraph<'g>` Sets the minimum value to display. Values less than this will be clamped to this value. If `None`, the minimum value is calculated from the data. #### `with_color_mode(self, color: ColorMode) -> BarGraph<'g>` Sets the color mode for the bars. The default is `ColorMode::VerticalGradient`. - `Solid`: Each bar has a single color based on its value. - `Gradient`: Each bar is gradient-colored from bottom to top. #### `with_bar_style(self, style: BarStyle) -> BarGraph<'g>` Sets the style of the bars. The default is `BarStyle::Braille`. - `Solid`: Render bars using the full block character ‘`█`’. - `Quadrant`: Render bars using quadrant block characters for a more granular representation. - `Octant`: Render bars using octant block characters for a more granular representation. - `Braille`: Render bars using braille characters for a more granular representation. ``` -------------------------------- ### Draw Text, Password, and Invisible Prompts Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/index.html Demonstrates how to draw different types of text prompts (Username, Password, Invisible) using TextPrompt and custom render styles. Requires a split UI layout. ```rust use ratatui::layout::{Constraint, Direction, Layout, Rect}; use ratatui::Frame; use tui_prompts::{Prompt, TextPrompt, TextRenderStyle, TextState}; struct App<'a> { username_state: TextState<'a>, password_state: TextState<'a>, invisible_state: TextState<'a>, } impl<'a> App<'a> { fn draw_ui(&mut self, frame: &mut Frame) { let (username_area, password_area, invisible_area) = split_layout(frame.area()); TextPrompt::from("Username").draw(frame, username_area, &mut self.username_state); TextPrompt::from("Password") .with_render_style(TextRenderStyle::Password) .draw(frame, password_area, &mut self.password_state); TextPrompt::from("Invisible") .with_render_style(TextRenderStyle::Invisible) .draw(frame, invisible_area, &mut self.invisible_state); } } fn split_layout(area: Rect) -> (Rect, Rect, Rect) { let rows = Layout::default() .direction(Direction::Vertical) .constraints([ Constraint::Length(1), Constraint::Length(1), Constraint::Length(1), ]) .split(area); (rows[0], rows[1], rows[2]) } ``` -------------------------------- ### ScrollMetrics::thumb_start Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the thumb start position in subcells. ```APIDOC ## ScrollMetrics::thumb_start ### Description Returns the thumb start position in subcells. ### Signature ```rust pub const fn thumb_start(&self) -> usize ``` ``` -------------------------------- ### State::value_mut Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets a mutable reference to the value of the prompt. ```APIDOC ## State::value_mut ### Description Gets a mutable reference to the value of the prompt. ### Method `fn value_mut(&mut self) -> &mut String` ### Returns A mutable reference to the prompt's value. ``` -------------------------------- ### take Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.SuitIter.html Creates an iterator that yields the first `n` elements. ```APIDOC ## fn take(self, n: usize) -> Take ### Description Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ### Method `take` ### Parameters - `n`: The maximum number of elements to yield. ### Returns A new iterator that yields at most `n` elements. ``` -------------------------------- ### State::status_mut Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets a mutable reference to the status of the prompt. ```APIDOC ## State::status_mut ### Description Gets a mutable reference to the status of the prompt. ### Method `fn status_mut(&mut self) -> &mut Status` ### Returns A mutable reference to the `Status` of the prompt. ``` -------------------------------- ### BarStyle::Octant Example Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/enum.BarStyle.html Renders bars using octant block characters for a more granular representation. This style offers high granularity but may have limited font support. ```rust /// Render bars using octant block characters for a more granular representation. ``` -------------------------------- ### fold_options Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.RankIter.html Folds Option values from an iterator, starting with an initial value. ```APIDOC ## fold_options ### Description Fold `Option` values from an iterator. ### Signature `fn fold_options(&mut self, start: B, f: F) -> Option` ### Constraints `Self: Iterator>` `F: FnMut(B, A) -> B` ``` -------------------------------- ### QrCodeWidget::new Source: https://docs.rs/tui-widgets/latest/tui_widgets/qrcode/struct.QrCodeWidget.html Creates a new QrCodeWidget with the provided QrCode data. ```APIDOC ## QrCodeWidget::new ### Description Create a new QR code widget. ### Method `pub fn new(qr_code: QrCode) -> QrCodeWidget` ### Parameters * `qr_code` (QrCode) - The QR code data to render. ``` -------------------------------- ### fold_ok Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.RankIter.html Folds Result values from an iterator, starting with an initial value. ```APIDOC ## fold_ok ### Description Fold `Result` values from an iterator. ### Signature `fn fold_ok(&mut self, start: B, f: F) -> Result` ### Constraints `Self: Iterator>` `F: FnMut(B, A) -> B` ``` -------------------------------- ### Generic ToCompactString and ToLine Implementations for Rank Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Rank.html Illustrates generic implementations for ToCompactString and ToLine, enabling efficient string conversions and line formatting. ```rust impl ToCompactString for T where T: Display, ``` ```rust fn try_to_compact_string(&self) -> Result ``` ```rust fn to_compact_string(&self) -> CompactString ``` ```rust impl ToLine for T where T: Display, ``` ```rust fn to_line(&self) -> Line<'_> ``` -------------------------------- ### Get Thumb Length in Subcells Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the thumb length in subcells. ```rust pub const fn thumb_len(&self) -> usize ``` -------------------------------- ### Get Track Length in Subcells Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the track length in subcells. ```rust pub const fn track_len(&self) -> usize ``` -------------------------------- ### Create and Render a BarGraph Widget Source: https://docs.rs/tui-widgets/latest/tui_widgets/bar_graph/index.html Instantiate a BarGraph with data, configure its appearance with gradients and bar styles, and render it within a widget area. Ensure necessary imports are included. ```rust use tui_bar_graph::{BarGraph, BarStyle, ColorMode}; let data = vec![0.0, 0.1, 0.2, 0.3, 0.4, 0.5]; let bar_graph = BarGraph::new(data) .with_gradient(colorgrad::preset::turbo()) .with_bar_style(BarStyle::Braille) .with_color_mode(ColorMode::VerticalGradient); frame.render_widget(bar_graph, area); ``` -------------------------------- ### Create a QrCodeWidget Source: https://docs.rs/tui-widgets/latest/tui_widgets/qrcode/struct.QrCodeWidget.html Instantiate a QrCodeWidget with a generated QrCode object. Ensure the QR code data is valid to avoid errors. ```rust use qrcode::QrCode; use tui_qrcode::QrCodeWidget; let qr_code = QrCode::new("https://ratatui.rs").expect("failed to create QR code"); let widget = QrCodeWidget::new(qr_code); ``` -------------------------------- ### ScrollViewState::offset Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollview/struct.ScrollViewState.html Gets the current offset of the scroll view state. ```APIDOC ## ScrollViewState::offset ### Description Get the offset of the scroll view state ### Returns - Position: The current offset of the scroll view. ``` -------------------------------- ### From and Into Implementations Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.Card.html Facilitates conversions to and from the Card type. ```rust fn from(t: T) -> T ``` ```rust fn into(self) -> U ``` -------------------------------- ### State::cursor_mut Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets a mutable reference to the cursor position of the prompt. ```APIDOC ## State::cursor_mut ### Description Gets a mutable reference to the cursor position of the prompt. ### Method `fn cursor_mut(&mut self) -> &mut (u16, u16)` ### Returns A mutable reference to the cursor position. ``` -------------------------------- ### Render Popup by Reference Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html Illustrates how to render a Popup widget by reference, which is useful when the popup data is long-lived and the `PopupState` needs to be updated across frames without moving the popup. The body must support rendering by reference. ```rust let popup = Popup::new(Text::from("Body")); let popup_ref = &popup; let mut state = PopupState::default(); pupup_ref.render(buffer.area, &mut buffer, &mut state); ``` -------------------------------- ### State::position_mut Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets a mutable reference to the cursor position in the prompt. ```APIDOC ## State::position_mut ### Description Gets a mutable reference to the cursor position in the prompt. ### Method `fn position_mut(&mut self) -> &mut usize` ### Returns A mutable reference to the cursor position. ``` -------------------------------- ### BigTextBuilder Initialization Source: https://docs.rs/tui-widgets/latest/tui_widgets/big_text/struct.BigTextBuilder.html Demonstrates the basic structure of the BigTextBuilder. This builder is used to construct BigText widgets. ```rust pub struct BigTextBuilder<'a> { /* private fields */ } ``` -------------------------------- ### State::focus_state_mut Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Gets a mutable reference to the focus state of the prompt. ```APIDOC ## State::focus_state_mut ### Description Gets a mutable reference to the focus state of the prompt. ### Method `fn focus_state_mut(&mut self) -> &mut FocusState` ### Returns A mutable reference to the `FocusState` of the prompt. ``` -------------------------------- ### ScrollMetrics::offset_for_thumb_start Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Converts a thumb start position (in subcells) to an offset (in subcells). ```APIDOC ## ScrollMetrics::offset_for_thumb_start ### Description Converts a thumb start position (in subcells) to an offset (in subcells). Thumb positions beyond the end of travel are clamped to the maximum offset. ### Signature ```rust pub fn offset_for_thumb_start(&self, thumb_start: usize) -> usize ``` ``` -------------------------------- ### CloneToUninit Implementation (Nightly) Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.Card.html Experimental nightly feature for copying Card data to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### BigText Widget Configuration Source: https://docs.rs/tui-widgets/latest/tui_widgets/big_text/struct.BigText.html Demonstrates how to create and configure a BigText widget using its builder pattern. You can set the pixel size, style, lines of text, and alignment. ```APIDOC ## BigText::builder() ### Description Creates a new `BigTextBuilder` to configure a `BigText` widget. ### Method `pub fn builder() -> BigTextBuilder<'static>` ### Example ```rust use ratatui::prelude::*; use tui_big_text::{BigText, PixelSize}; BigText::builder() .pixel_size(PixelSize::Full) .style(Style::new().white()) .lines(vec![ "Hello".red().into(), "World".blue().into(), "=====".into(), ]) .build(); ``` ``` -------------------------------- ### ScrollMetrics::thumb_start_for_offset Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Converts an offset (in subcells) to a thumb start position (in subcells). ```APIDOC ## ScrollMetrics::thumb_start_for_offset ### Description Converts an offset (in subcells) to a thumb start position (in subcells). Larger offsets move the thumb toward the end of the track, clamped to the maximum travel. ### Signature ```rust pub fn thumb_start_for_offset(&self, offset: usize) -> usize ``` ``` -------------------------------- ### Create Popup with Title and Body Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html Shows how to create a new Popup instance with a specified body and title. This is the basic constructor for the Popup widget. ```rust use tui_popup::Popup; let popup = Popup::new("Press any key to exit").title("tui-popup demo"); ``` -------------------------------- ### Get Maximum Thumb Travel Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the maximum thumb travel in subcells. ```rust pub const fn thumb_travel(&self) -> usize ``` -------------------------------- ### Get Maximum Scrollable Offset Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the maximum scrollable offset in subcells. ```rust pub const fn max_offset(&self) -> usize ``` -------------------------------- ### Get Current Offset Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the current content offset in logical units. ```rust pub const fn offset(&self) -> usize ``` -------------------------------- ### Render Popup by Reference Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html This section describes how to render a `Popup` widget by reference. It's useful when you want to keep a `Popup` instance alive and render it without rebuilding it each frame, especially when the popup's body implements `Widget` for references. ```APIDOC ## `impl<'a, W> Widget for &Popup<'a, W>` ### Description Reference render path for a popup body that supports rendering by reference. Use this when you want to keep a `Popup` around and render it by reference. This is helpful when the body implements `Widget` for references (such as `Text`), or when you need to avoid rebuilding the widget each frame. ### Method `render` ### Signature `fn render(self, area: Rect, buf: &mut Buffer)` ### Purpose Draws the current state of the widget in the given buffer. This is the only method required to implement a custom widget. ### Example ```rust let popup = Popup::new(Text::from("Body")); let popup_ref = &popup; popup_ref.render(buffer.area, &mut buffer); ``` ``` -------------------------------- ### Get Viewport Length Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the current viewport length in logical units. ```rust pub const fn viewport_len(&self) -> usize ``` -------------------------------- ### Create a New ScrollBar Instance Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollBar.html Demonstrates the creation of a ScrollBar with a specified orientation and content/viewport lengths. Note that zero lengths are treated as 1. ```rust use tui_scrollbar::{ScrollBar, ScrollBarOrientation, ScrollLengths}; let lengths = ScrollLengths { content_len: 120, viewport_len: 40, }; let scrollbar = ScrollBar::new(ScrollBarOrientation::Vertical, lengths); ``` -------------------------------- ### TryFrom Implementation Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollBar.html Allows attempting to convert a value into a ScrollBar, returning a Result. ```APIDOC ### impl TryFrom for T where U: Into, #### type Error = Infallible ### Description The `Error` type is `Infallible`, meaning this conversion will not fail. #### fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion. Since the error type is `Infallible`, this function will always return `Ok`. ``` -------------------------------- ### Get Content Length Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the current content length in logical units. ```rust pub const fn content_len(&self) -> usize ``` -------------------------------- ### SuitIter ExactSizeIterator Methods Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.SuitIter.html Information on methods related to the exact size of the SuitIter. ```APIDOC ## ExactSizeIterator Methods for SuitIter ### Description Provides methods for determining the exact size of the iterator. ### Methods - **`len(&self) -> usize`** Returns the exact remaining length of the iterator. - **`is_empty(&self) -> bool`** Returns `true` if the iterator is empty. (Nightly-only) ``` -------------------------------- ### Get Thumb Range in Subcell Coordinates Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the thumb range in subcell coordinates. ```rust pub const fn thumb_range(&self) -> Range ``` -------------------------------- ### Get Track Length in Terminal Cells Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollMetrics.html Returns the track length in terminal cells. ```rust pub const fn track_cells(&self) -> usize ``` -------------------------------- ### Render a Basic Popup Widget Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/index.html Build and render a simple popup with a title and custom style. This is useful for displaying temporary messages or information. ```rust use ratatui::style::{Style, Stylize}; use ratatui::Frame; use tui_popup::Popup; fn render_popup(frame: &mut Frame) { let popup = Popup::new("Press any key to exit") .title("tui-popup demo") .style(Style::new().white().on_blue()); frame.render_widget(popup, frame.area()); } ``` -------------------------------- ### State::handle_key_event Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Handles a key event for the prompt. ```APIDOC ## State::handle_key_event ### Description Handles a key event for the prompt. ### Method `fn handle_key_event(&mut self, key_event: KeyEvent)` ### Parameters #### Path Parameters - **key_event** (KeyEvent) - The key event to handle. ``` -------------------------------- ### TryInto Implementation Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollBar.html Allows attempting to convert a ScrollBar into another type, returning a Result. ```APIDOC ### impl TryInto for T where U: TryFrom, #### type Error = >::Error ### Description The `Error` type is determined by the `TryFrom` implementation for the target type `U`. #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion. Returns a `Result` which is `Ok` on success or `Err` if the conversion fails. ``` -------------------------------- ### Popup::new Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html Creates a new Popup widget with the specified body. This is the entry point for creating a Popup. ```APIDOC ## Popup::new ### Description Creates a new popup with the given title and body with all the borders. ### Parameters - `body` (W) - The body of the popup. This can be any type that can be converted into a `Text`. ### Example ```rust use tui_popup::Popup; let popup = Popup::new("Press any key to exit").title("tui-popup demo"); ``` ``` -------------------------------- ### Render BigText widget with custom style and lines Source: https://docs.rs/tui-widgets/latest/tui_widgets/big_text/index.html Create a BigText widget using its builder, customizing pixel size and style, then render it to the frame. Ensure ratatui and tui_big_text are imported. ```rust use ratatui::prelude::{Frame, Style, Stylize}; use tui_big_text::{BigText, PixelSize}; fn render(frame: &mut Frame) { let big_text = BigText::builder() .pixel_size(PixelSize::Full) .style(Style::new().blue()) .lines(vec![ "Hello".red().into(), "World".white().into(), "~~~~~".into(), ]) .build(); frame.render_widget(big_text, frame.size()); } ``` -------------------------------- ### ScrollBarArrows Enum Definition Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/enum.ScrollBarArrows.html Defines the possible variants for scrollbar arrow endcaps: None, Start, End, and Both. ```APIDOC ## Enum ScrollBarArrows ### Summary ``` pub enum ScrollBarArrows { None, Start, End, Both, } ``` ### Description Which arrow endcaps to render on the track. ### Variants #### None Do not render arrow endcaps. #### Start Render the arrow at the start of the track (top/left). #### End Render the arrow at the end of the track (bottom/right). #### Both Render arrows at both ends of the track. ``` -------------------------------- ### Render Popup by Value Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html This section explains how to render an owned `Popup` widget by value. This is the most straightforward method for new users and works well with common body types like `&str` or `String`. ```APIDOC ## `impl Widget for Popup<'_, W>` ### Description Owned render path for a popup. Use this when you have an owned `Popup` value and want to render it by value. This is the simplest option for new users, and it works well with common bodies like `&str` or `String`. ### Method `render` ### Signature `fn render(self, area: Rect, buf: &mut Buffer)` ### Purpose Draws the current state of the widget in the given buffer. This is the only method required to implement a custom widget. ### Example ```rust let popup = Popup::new("Body"); popup.render(buffer.area, &mut buffer); ``` ``` -------------------------------- ### State::complete Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Completes the prompt. ```APIDOC ## State::complete ### Description Completes the prompt. ### Method `fn complete(&mut self)` ``` -------------------------------- ### Get Suit Color Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Suit.html Returns the associated color for each suit. This is useful for displaying suits with their correct colors. ```rust pub const fn color(self) -> Color ``` -------------------------------- ### Initialize TextState Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Creates a new TextState instance. This is the basic constructor for the state. ```rust pub const fn new() -> TextState<'a> ``` -------------------------------- ### Get TextState Length Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Returns the number of characters in the prompt's current value. This is equivalent to the length of the string. ```rust fn len(&self) -> usize ``` -------------------------------- ### TextState::new Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextState.html Creates a new TextState with default values. ```APIDOC ## TextState::new ### Description Creates a new `TextState` with default values. ### Method `const fn new() -> TextState<'a>` ### Returns A new `TextState` instance. ``` -------------------------------- ### Get Status Symbol Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/enum.Status.html Returns a Span representing the symbol for the current status. This is useful for displaying status indicators. ```rust pub fn symbol(&self) -> Span<'static> ``` -------------------------------- ### Create and Render a Vertical ScrollBar Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollBar.html Demonstrates how to create a vertical ScrollBar with specified content and viewport lengths, set an offset, and render it to a buffer. ```rust use ratatui_core::buffer::Buffer; use ratatui_core::layout::Rect; use ratatui_core::widgets::Widget; use tui_scrollbar::{ScrollBar, ScrollLengths}; let area = Rect::new(0, 0, 1, 5); let lengths = ScrollLengths { content_len: 200, viewport_len: 40, }; let scrollbar = ScrollBar::vertical(lengths).offset(60); let mut buffer = Buffer::empty(area); scrollbar.render(area, &mut buffer); ``` -------------------------------- ### Any Trait Implementation Source: https://docs.rs/tui-widgets/latest/tui_widgets/box_text/struct.BoxChar.html Provides the `type_id` method for getting the `TypeId` of the boxed type. This is part of the standard `Any` trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Render Popup by Reference Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html Use this when you want to keep a `Popup` around and render it by reference. This is helpful when the body implements `Widget` for references (such as `Text`), or when you need to avoid rebuilding the widget each frame. ```rust let popup = Popup::new(Text::from("Body")); let popup_ref = &popup; popup_ref.render(buffer.area, &mut buffer); ``` -------------------------------- ### Generic Equivalent and From Implementations for Rank Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Rank.html Demonstrates generic implementations for Equivalent and From traits, enabling flexible comparisons and type conversions. ```rust impl Equivalent for Q where Q: Eq + ?Sized, K: Borrow + ?Sized, ``` ```rust fn equivalent(&self, key: &K) -> bool ``` ```rust impl From for T ``` ```rust fn from(t: T) -> T ``` -------------------------------- ### State Trait - Position Methods Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/trait.State.html Methods for getting and setting the cursor's position within the prompt's value. ```rust fn position(&self) -> usize; ``` ```rust fn position_mut(&mut self) -> &mut usize; ``` -------------------------------- ### Get Colored Suit Symbol Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Suit.html Returns the suit symbol as a colored string. This combines the symbol with its appropriate color for display. ```rust pub const fn as_colored_symbol(self) -> &'static str ``` -------------------------------- ### Get Drag State Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.PopupState.html Returns the current drag state of the popup. This indicates whether the popup is currently being dragged by the user. ```rust pub fn drag_state(&self) -> &DragState ``` -------------------------------- ### Render Popup by Value Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.Popup.html Use this when you have an owned `Popup` value and want to render it by value. This is the simplest option for new users, and it works well with common bodies like `&str` or `String`. ```rust let popup = Popup::new("Body"); popup.render(buffer.area, &mut buffer); ``` -------------------------------- ### by_ref Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.SuitIter.html Creates a reference adapter for the iterator. ```APIDOC ## fn by_ref(&mut self) -> &mut Self ### Description Creates a “by reference” adapter for this instance of `Iterator`. ### Method `by_ref` ### Returns A mutable reference to the iterator itself, allowing methods to be called on the reference. ``` -------------------------------- ### Get Width to Position in TextState Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Calculates the character width of the stored value up to a given position. This is useful for rendering or layout calculations. ```rust fn width_to_pos(&self, pos: usize) -> usize ``` -------------------------------- ### Configure TextPrompt with a Block Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextPrompt.html Applies a Block widget to the TextPrompt for visual framing and layout customization. ```rust pub fn with_block(self, block: Block<'a>) -> TextPrompt<'a> ``` -------------------------------- ### Card::new Constructor Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.Card.html Creates a new Card instance with the specified rank and suit. ```APIDOC ## impl Card ### pub const fn new(rank: Rank, suit: Suit) -> Card Creates a new Card instance with the specified rank and suit. ``` -------------------------------- ### Get Mutable TextState Status Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Returns a mutable reference to the status of the prompt. Allows direct modification of the prompt's status. ```rust fn status_mut(&mut self) -> &mut Status ``` -------------------------------- ### Create and Render BoxChar Widget Source: https://docs.rs/tui-widgets/latest/tui_widgets/box_text/index.html Use this snippet to create a BoxChar instance and render it within a specified area of your Ratatui frame. Ensure the `tui_box_text` crate is included in your dependencies. ```rust use tui_box_text::BoxChar; let letter = BoxChar::new('A'); frame.render_widget(&letter, frame.area()); ``` -------------------------------- ### Get TextState Status Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Returns the current status of the prompt. The status indicates the prompt's state (e.g., active, completed). ```rust fn status(&self) -> Status ``` -------------------------------- ### take Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.RankIter.html Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ```APIDOC ## take(self, n: usize) -> Take ### Description Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ### Parameters - `n`: The maximum number of elements to yield. ### Returns A new iterator that yields at most `n` elements. ``` -------------------------------- ### Rank as_symbol Implementation Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Rank.html Provides a method to get the character symbol for each Rank variant. This is useful for displaying ranks as single characters. ```rust pub const fn as_symbol(self) -> char ``` -------------------------------- ### Create and Render a Playing Card Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/index.html Instantiate a `Card` with a specific rank and suit, then render it within the provided frame area. Ensure `tui_cards` is imported. ```rust use tui_cards::{Card, Rank, Suit}; let card = Card::new(Rank::Ace, Suit::Spades); frame.render_widget(&card, frame.area()); ``` -------------------------------- ### fn product1

(self) -> Option

Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/struct.SuitIter.html Calculates the product of all elements in the iterator. ```APIDOC ## fn product1

(self) -> Option

### Description Iterate over the entire iterator and multiply all the elements. ### Returns - **Option

** - The product of the elements, or `None` if the iterator is empty. ``` -------------------------------- ### Get Mutable TextState Focus Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextState.html Returns a mutable reference to the focus state of the prompt. Allows direct modification of the prompt's focus. ```rust fn focus_state_mut(&mut self) -> &mut FocusState ``` -------------------------------- ### TextPrompt::new Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextPrompt.html Creates a new TextPrompt with a given message. ```APIDOC ## TextPrompt::new ### Description Creates a new TextPrompt with a given message. ### Method `pub const fn new(message: Cow<'a, str>) -> TextPrompt<'a>` ### Parameters - **message** (Cow<'a, str>) - The message to display with the prompt. ``` -------------------------------- ### Get Four-Color Suit Symbol Source: https://docs.rs/tui-widgets/latest/tui_widgets/cards/enum.Suit.html Returns the suit symbol using the four-color deck convention. This is useful for specific card game representations. ```rust pub const fn as_four_color_symbol(self) -> &'static str ``` -------------------------------- ### Create a new TextPrompt Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextPrompt.html Constructs a new TextPrompt with a given message. The message can be a static string or an owned string. ```rust pub const fn new(message: Cow<'a, str>) -> TextPrompt<'a> ``` -------------------------------- ### TextPrompt::with_block Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextPrompt.html Configures the TextPrompt with a specific block. ```APIDOC ## TextPrompt::with_block ### Description Configures the TextPrompt with a specific block. ### Method `pub fn with_block(self, block: Block<'a>) -> TextPrompt<'a>` ### Parameters - **block** (Block<'a>) - The block to associate with the prompt. ``` -------------------------------- ### Get Popup Area Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/struct.PopupState.html Retrieves the last rendered area of the popup. This is useful for determining the popup's current position and dimensions on the screen. ```rust pub fn area(&self) -> &Option ``` -------------------------------- ### Default TextPrompt Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/prelude/struct.TextPrompt.html Provides a default TextPrompt instance. This is useful when a basic prompt is needed without specific initial configuration. ```rust fn default() -> TextPrompt<'a> ``` -------------------------------- ### Create New ScrollBarInteraction Source: https://docs.rs/tui-widgets/latest/tui_widgets/scrollbar/struct.ScrollBarInteraction.html Use this function to create a fresh interaction state with no active drag. This is the starting point for managing scrollbar drag interactions. ```rust pub fn new() -> ScrollBarInteraction ``` -------------------------------- ### TextPrompt::with_render_style Source: https://docs.rs/tui-widgets/latest/tui_widgets/prompts/struct.TextPrompt.html Sets the render style for the TextPrompt. ```APIDOC ## TextPrompt::with_render_style ### Description Sets the render style for the TextPrompt. ### Method `pub const fn with_render_style(self, render_style: TextRenderStyle) -> TextPrompt<'a>` ### Parameters - **render_style** (TextRenderStyle) - The render style to apply. ``` -------------------------------- ### KnownSize Implementation for Text<'_> Source: https://docs.rs/tui-widgets/latest/tui_widgets/popup/trait.KnownSize.html Provides a KnownSize implementation for Text widgets. Use this when the popup body is a Text widget. ```rust impl KnownSize for Text<'_> { fn width(&self) -> usize { // Implementation details } fn height(&self) -> usize { // Implementation details } } ```